Hi this question is related to this but this one saves the event as .ics format. I'm thinking of something like when a link is click it will open the google and save it automatically just like the screen below . So its something like the image below after I click a link it will redirect me to the google calendar page
Asked
Active
Viewed 555 times
-2

MadzQuestioning
- 3,341
- 8
- 45
- 76
1 Answers
0
Try out this:
<?php
$url = 'https://www.google.com/calendar/render?action=TEMPLATE&text={{ text }}&dates={{ start }}/{{ end }}&details={{ details }}&location={{ location }}&sf=true&output=xml';
$event = [
'text' => 'Your Event Name',
'start' => date('Ymd\THis\Z', strtotime('today')),
'end' => date('Ymd\THis\Z', strtotime('tomorrow')),
'details' => 'Click here for more details: http://example.com',
'location' => 'Waldorf Astoria, 301 Park Ave , New York, NY 10022'
];
foreach ($event as $key => $value) {
$url = str_replace("{{ $key }}", urlencode($value), $url);
}
echo $url;
When you navigate to the generated URL, the page should look like on the screenshot.

kopaty4
- 2,236
- 4
- 26
- 39