I made a dynamically generated iCalendar feed with PHP, sticking to RFC 5545. It's working just fine for the most part, except iCal (i.e. Mac OS X's built-in calendar program) seems to refuse to reflect updates to events it had previously already downloaded. I'm assuming this is due to caching. Is there a way I can tell iCal not to cache my feed?
EDIT: Oh yeah, I forgot to mention that I've already tried making each VEVENT have a different UID each time the feed is called (my UID format is "id", where is the current time in RFC 5545's DATE-TIME format, and is the unique ID of the event in my database). I've also tried playing with the Content-type in the header; this problem happens whether I set it to text/plain or text/calendar
I've never dealt with iCal but try setting the headers to force revalidation.
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
Have you tried adding "no-cache" headers?
<?php
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); //date in the past
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); //tell it we just updated
header( 'Cache-Control: no-store, no-cache, must-revalidate' ); //force revaidation
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With