Import events into calendar JSON format

5

I want to import events from a non-private, server-side Google Calendar (PHP) into JSON format.

Since I just want to receive information and do not need to edit / create events I assume there is a way that does not need authentication.

I know that it is possible via iCal to download a file with the calendar data with syntax: http://www.google.com/calendar/ical/{ID}/public/basic.ics , and that works in my case.

But I wanted to get the same but in JSON format and via PHP. Any suggestions?

    
asked by anonymous 04.02.2014 / 00:13

2 answers

4

You just need to tell Google Calendar that you want a JSON, passing it as a parameter, and to redeem JSON, use the file_get_contents() function of PHP.

$json = file_get_contents('http://www.google.com/calendar/feeds/[email protected]/public/full?alt=json');  
echo $json;

Note that you are using the same {ID} that you used to fetch ICS, but you are now requesting a JSON.

You can get specific and detailed information from Google Developers about using JSON to retrieve information Here .

    
04.02.2014 / 00:37
3

There are many components ready to extract information from calendars in ICS format.

Try for example this class PHP iCal Parser . Note, I moderated this site, but I did not develop this class.

    
04.02.2014 / 00:37