0
votes

I've written a php script which produces an ics file output:

BEGIN:VCALENDAR
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:20120801T000000Z
DTSTART:20120801T000000Z
DTEND:20120801T000000Z
SUMMARY:test
ORGANIZER:Me
UID:Me
END:VEVENT
END:VCALENDAR

The file is shown to be valid when using the online validator:

http://severinghaus.org/projects/icv/

Now here's the strange thing.... If I opt to open the file as it is generated by the php I get the MS Outlook error message is not a valid internet calendar file. But, if I open it from the folder it's created in, it gets imported without trouble.

Does anyone have any ideas?

1
What operating system are you using?dualed
Are you sending the appropriate headers when echoing out the content?Josh

1 Answers

0
votes

As josh has noted, it is probably incorrect headers:

eg: ics file generated from wordpress plugin has:

header('Content-Type: text/calendar; charset=' . get_option('blog_charset').';');
header('Content-Disposition: attachment; filename="ical.ics"');