Avatar of Lennart Ericson
Lennart Ericson
Flag for Sweden asked on

How to add a notification in a calendar

I've got a booking script. I'd like to get a notification in the bookers calendar, being it MS Outlook calendar, Google Calendar or any other popular caledar. I have very little experience in this field and seek basic "how to" information".
Serverside language: php.
Google WorkspaceOutlookPHP

Avatar of undefined
Last Comment
Lennart Ericson

8/22/2022 - Mon
Ray Paseur

There is a calendar standard called hCalendar that implements RFC2445.  Some other keywords of interest are iCal and vCal.  These use the iCalendar file format which is the defacto standard for calendar information interchange.  

You may be able to use PHP to force a download of a file with the ics file suffix.  The client's computer may associate the .ics files with a calendar program.  This file extension is used for calendaring and scheduling information.

The MIME type for iCalendar data is text/calendar.

I've done this in the past with an "add this event to my calendar" link.  The link went to a PHP script and it had a URL parameter giving a key to the calendar entry.  The PHP script used the key to locate the event row in the calendar database table.  It generated an iCalendar object, which is a simple text file like this (thanks, Wikipedia)
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:uid1@example.com
DTSTAMP:19970714T170000Z
ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR

Open in new window

If I can find a code example for this, I'll post it here and update these articles about handling date and time in PHP.
https://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL-Procedural-Version.html
https://www.experts-exchange.com/articles/20920/Handling-Time-and-Date-in-PHP-and-MySQL-OOP-Version.html
ASKER CERTIFIED SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Lennart Ericson

ASKER
Thank you! Sorry for not having responded eaarlier.
Regards
Lennart
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes