I have build a service for all my events in the database. The service workes fine when called within javascript. Now i am trying to get the results on page load in php. On the Service Page (events.php) i have a switch function like this:
$switcher = isset($_REQUEST["set"]) ? $_REQUEST["set"] : "";
switch ($switcher)
{
case 'list':
$events = $_crs->listCourse();
echo json_encode($events);
break;
...
default:
break;
}
In javascript i give a parameter that do the switch like this:
url: "events.php?set=all";
And in Php i am trying to get the results by running this:
$list = file_get_contents( "events.php?set=list&from=$from&to=$to&category=&limit=15");
Problem 1: When i do this i get this error: failed to open stream: No such file or directory in
Problem 2: when leaving out the get variables i get the raw php code from the events.php file!
How can i solve this prpblem?