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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Plesk

From novice to tech pro — start learning today.