I want to fetch data from https://aloostad.com/api/PodcastCourse?Page=1 and show data items in the console but PHP gives me an error.
<?php
// $response = file_get_contents('https://aloostad.com/api/PodcastCourse');
// $response = json_decode($response);
// // $response = new SimpleXMLElement($response);
// echo "<script>console.log(" . $response . " );</script>";
$url = "https://aloostad.com/api/PodcastCourse?Page=1";
$parts = parse_url($url);
$output = [];
parse_str($parts['query'], $output);
// echo $output['page'];
echo "<script>console.log('" . $output['page'] . "');</script>";
?>
This site has Swagger at the URL https://aloostad.com/swagger/index.html
The error is
Notice: Undefined index: page in C:\xampp\htdocs\mamad.php on line 12