Note that there are some explanatory texts on larger screens.

plurals
  1. POfullcalendar events from REST-ful php server
    text
    copied!<p>I've written a very simple RESTful php server (my first experiment with REST, so feel free to make suggestions) to respond to the fullcalendar events callback. It produces exactly the same string output as the json-events.php file in the fullcalendar json example, but for some reason fullcalendar will not accept my server's output. </p> <p>I've tried messing with the headers because they're different from the ones produced by json-events.php, but I'm not really sure what's awry there, if anything.</p> <p>The code for the server is below:</p> <pre><code>&lt;?php class Listener{ function __construct() { $this-&gt;getResource(); $this-&gt;buildResponse(); } function getResource(){ $parts = explode('/', $_SERVER["REQUEST_URI"]); $script_name = end(explode('/', $_SERVER["SCRIPT_NAME"])); $this-&gt;resource = $parts[array_search($script_name, $parts) + 1]; $this-&gt;resource_id = $parts[array_search($script_name, $parts) + 2]; } function buildResponse(){ $method = strtolower($_SERVER["REQUEST_METHOD"]); $this-&gt;response_string = $method . ucwords($this-&gt;resource); } function getResponse(){ return $this-&gt;response_string; } } $listener = new Listener(); $thing = $listener-&gt;getResponse(); $thing(); function getEvents(){ $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' =&gt; 111, 'title' =&gt; "Event1", 'start' =&gt; "$year-$month-10", 'url' =&gt; "http://yahoo.com/" ), array( 'id' =&gt; 222, 'title' =&gt; "Event2", 'start' =&gt; "$year-$month-20", 'end' =&gt; "$year-$month-22", 'url' =&gt; "http://yahoo.com/" ) )); } ?&gt; </code></pre> <p>Any input, help or suggestions would be greatly appreciated!</p> <p>Thanks, David</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload