Dynamic .ics from php not updating on Google Calendar.

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";
?>
+5
source share
3 answers

csanyigabor . , UID , . , ics?

+2

, SEQUENCE VEVENT, .

+2

@csanyigabor - , @anmari, , . ICS, anmari, , UID , . , (, . 5 , ).

https://tools.ietf.org/html/rfc5545 ( → https://tools.ietf.org/html/rfc7986), . 3.8.7.4. Sequence Number, , .

  Description: When a calendar component is created, its sequence
  number is 0.  It is monotonically incremented by the "Organizer's"
  CUA each time the "Organizer" makes a significant revision to the
  calendar component.

, UID 3.8.4.7. Unique Identifier

  Description:  The "UID" itself MUST be a globally unique identifier.
  The generator of the identifier MUST guarantee that the identifier
  is unique.  There are several algorithms that can be used to
  accomplish this.  A good method to assure uniqueness is to put the
  domain name or a domain literal IP address of the host on which
  the identifier was created on the right-hand side of an "@", and
  on the left-hand side, put a combination of the current calendar
  date and time of day (i.e., formatted in as a DATE-TIME value)
  along with some other currently unique (perhaps sequential)
  identifier available on the system (for example, a process id
  number).  Using a DATE-TIME value on the left-hand side and a
  domain name or domain literal on the right-hand side makes it
  possible to guarantee uniqueness since no two hosts should be
  using the same domain name or IP address at the same time.  Though
  other algorithms will work, it is RECOMMENDED that the right-hand
  side contain some domain identifier (either of the host itself or
  otherwise) such that the generator of the message identifier can
  guarantee the uniqueness of the left-hand side within the scope of
  that domain.

Example: The following is an example of this property:

 UID:19960401T080045Z-4000F192713-0052@host1.com
0

All Articles