I am trying to create a .ics page in php that needs to be added to Google Calendar via "Add by URL" so that I can receive events from the database and present them on the calendar.
I was looking at SO at that time and found another message that was very useful at startup, but now I am in a trap that does not seem to affect those with similar code. The message can be found here .
So my problem is that I cannot get Google Calendar to refresh my page as if it were caching the page on a calendar. Therefore, when I add another VEVENT to the page, it does not update the calendar.
When creating a file, it generates the correct format for the * .ics file. The format shown below.
If I go directly to the page, I will be prompted to upload a file that works for import into GC, and if I add the same code to another page, for example, changing the page name from cal.php to cal2.php will make GC read all events , and when I just add the same URL as before it doesn’t get any changes made to the file.
Does anyone have an idea why this is not updating?
Others who had similar problems solved this by adding a UID to their VEVENT, which didn't solve anything for me ...
Generated format
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:17d88c861131ec62f18835cdd4eb7d0c@yourhost.test
DTSTAMP:20110901T092002Z
DTSTART:20110925T170000Z
DTEND:20110928T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
BEGIN:VEVENT
UID:00813115d1a2d21447eb11ded3ba9020@yourhost.test
DTSTAMP:20110901T092002Z
DTSTART:20110929T170000Z
DTEND:20110930T035959Z
SUMMARY:Camping Trip
END:VEVENT
BEGIN:VEVENT
UID:1f18d85fe516d684536129ed066e7d4f@yourhost.test
DTSTAMP:20110901T092002Z
DTSTART:20110914T170000Z
DTEND:20110915T035959Z
SUMMARY:Testing new Event
END:VEVENT
END:VCALENDAR
Code used
<?php
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=\"calendar.ics\"");
echo "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:20110925T170000Z
DTEND:20110928T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:20110929T170000Z
DTEND:20110930T035959Z
SUMMARY:Camping Trip
END:VEVENT
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:20110914T170000Z
DTEND:20110915T035959Z
SUMMARY:Testing new Event
END:VEVENT
END:VCALENDAR";
?>