Adding header('Content-Type: text/calendar; charset=utf-8') causing ERR_INVALID_RESPONSE and FILE_NOT_FOUND errors

HI,

I have created a php script for individuals to add a url to their calendar application such as outlook/ google calendar.


 I have validated the output on https://icalendar.org/ and get a header warning about the content type being text/html

Validator

Problem is when i add
           header('Content-Type: text/calendar; charset=utf-8');
	//		header('Content-Disposition: inline; filename=calendar.ics');

Open in new window


i get

chrome -> ERR_INVALID_RESPONSE
firefox -> file not found
ie -> i get a download prompt that could not be downloaded if save is clicked

if i add the URL to outlook it throws an invalid url error

Not sure whats going on here because i had it working last night


i am using plesk on my centos 7 server
LVL 6
J NUnicorn wranglerAsked:
Who is Participating?
 
David Johnson, CD, MVPOwnerCommented:
Don't really understand your question
to add a url insde of the .ics you add
URL;TYPE=Official Site:http://www.example.com/venues/clubvenues

Open in new window

 /sandiego/

perhaps if you showed your code we may get more information to formulate an answer
0
 
J NUnicorn wranglerAuthor Commented:
The URL is
https://mjmnagy.info/calendar/p-kFw0z84YSztlBImYsTDHpuEMQP2wrV7XE5hZbjrlZmY0t08FwIOpR4ieHapJp0QSfqFS%2BAp%2BRpaTPp5hpHRKYQ%3D%3D

Open in new window


which outputs  via echo "<pre>";  -> the pre tag was just use for this question to show the format
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN
X-WR-CALNAME: test Calendar
VERSION:2.0
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VTIMEZONE
TZID: America/Edmonton
X-LIC-LOCATION: America/Edmonton
BEGIN:STANDARD
DTSTART:20180424T202704Z
TZOFFSETFROM:+0001
TZOFFSETTO:-0001
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED: 20180516T130100Z
DESCRIPTION: Activity type: Other
DTSTAMP:20180516T130100Z
DTSTART:20180516T130100Z
DTEND:20170314T130100Z
LAST-MODIFIED:20180516T130100Z
LOCATION:    
TZID: America/Edmonton
SEQUENCE:0
SUMMARY: forest lawn seniors center
TRANSP:OPAQUE
UID:5ae0e4984fd2a
URL;VALUE=URI:https://www.mjmnagy.info/squads/forest-lawn
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-ALLOWEXTERNCHECK:TRUE
X-MS-OLK-AUTOFILLLOCATION:FALSE
X-MS-OLK-CONFTYPE:0
BEGIN:VALARM
TRIGGER:-PT1H
REPEAT:1
DESCRIPTION: Other
ACTION:DISPLAY
DURATION:PT30M
X-ALT-DESC;FMTTYPE=text/html: Other
END:VALARM
END:VEVENT
END:VCALENDAR

Open in new window


If you validate the text there is no errors.

However, if i try and add this url to outlook / gmail /etc this does not work.

There are some funny things going on

1) in the morning when i wrote this questions https://icalendar.org/validator.html would fetch the results from the URL - it is not anymore
2) When i add the missing content headers in php - the file cannot be found
0
 
J NUnicorn wranglerAuthor Commented:
Another strange this is it just started to work>

Im an so lost why this is happening
0
 
J NUnicorn wranglerAuthor Commented:
- So i removed the URL encoding because that seemed to be causing a problem between copying and pasting the link and clicking it.

But i still cannot get the link to add into outlook/gmail

and it still wont validate at the icalendar.org

new link :  
https://www.mjmnagy.info/calendar/p-kFw0z84YSztlBImYsTDHpuEMQP2wrV7XE5hZbjrlZmY0t08FwIOpR4ieHapJp0QSfqFS+Ap+RpaTPp5hpHRKYQ==

Open in new window

0
 
J NUnicorn wranglerAuthor Commented:
It all works now

I have no idea what i changed but for some reason it works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.