I know there are a lot of tutorials, but for some reason I am not managing to focus the search to my specific issue.
I want to have a link to download <a href="#" download="cal.ics">click</a>
For some reason it fills the file with all the echo's from my page instead of a string that i can prepare.
What am I missing?
Edit:
I want the file to contain the return of this function:
function createICS(){
header("Content-Type: text/Calendar; charset=utf-8'");
header("Content-Disposition: inline; filename=calendar.ics");
$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Geektike/eventsboard//IL
BEGIN:VEVENT
UID:123456789
SUMMARY:asd
DTSTART:20140520T210000Z
DTEND:20140520T220000Z
LAST-MODIFIED:20111115T103014Z
LOCATION:here
DESCRIPTION:cool
END:VEVENT
END:VCALENDAR";
return $ical;
exit;
}