instantly push event to ical calendar subscriber - php

I have created a code which generates .ics to synchronize events from my application to other calendar system like google, mac-ical, outlook etc.
I add url to these systems and all events from my application get synchronized.
This code does work fine but problem is event doesn't get synchronized instantly, it takes time to fetch events automatically.
So I want to make all events to get pushed to all subcribers, so that they get instantly updated, many applications do provide such things, in that I get instant update to my iCal on creating event.
So that is possible, I want to know how can I do it using php language, what technology I need to push events, instead of auto fetching by calendar system.
It will get general push to all subscribers not for any particular system like google calendar, I know it does have its own API.

Related

Is web calendar publishing (.ical or ics) pushed by publisher or pulled by subscriber?

In my custom php web application I want to publish an ical calendar using calendar events I'm selecting from my own database. After I create the ical file and create a link to it, and then the (iphone subscriber for example) sets up their subscription information to pull it, how do changes get sync'ed back to the subscriber after the initial pull? Is the subscriber software regularly polling for changes? Or do I have to push the changes somehow?
I've looked around for this information but there is not a concise answer.
An iCalendar feed is pulled by the client. There's no standard for how often or when it does this, it depends on your client when it decides to refresh.
Microsoft Outlook respects the X-PUBLISHED-TTL field.
Google Calendar refreshes every up to 8 hours.
Apple's iCal has a Refresh option in the menu.
Mozilla Thunderbird's Lightning add-on has a configurable refresh option.

Creating list of calendar events that auto updates

I'm attempting to make an extremely basic list of calendar events that will automatically update once an event is over. If I were making this with HTML, I would create an ordered list, and each list item would be an event.
Not sure if PHP could make this happen, or how that would work.
Would it be easier to tie this into Google Calendar?
Sure, you could store events in a database and read them out using PHP or any number of other languages. The basic idea is to get the next n events that have a date/time greater than the current date/time.
But if you're not already familiar with databases and how to interface with them from a web page, Google Calendar could save you a lot of time. You get a lot for free, including multiple calendars, event notifications, multi-day events, sharing between users, and lots more. Plus Google generates HTML code that can be dropped straight into your web page for a simple embedded calendar. For more advanced usages, you can use the Google Calendar API (https://developers.google.com/google-apps/calendar/).

import the events i get invited to on facebook into my website using php

I would like to basically get all the events that i get invited to on facebook to feed my internal website DB with that info; lets say every day using a cron. the problem is that I think you can get the events if you are the one posting the event not the one receiving the invite.
am I wrong or can someone offer me some insight into how to get this accomplished
You can get the events you have not replied using me/events/not_replied or using Graph Api Explorer.
You can get all upcoming events that you have subscribed/accepted via me/events call. Graph APi Exlporer
and save the time in your db and use since parameter with that time to get latest subscribed events.
If you are running cron job then make sure you are not duplicating or missing some events.

Google Calendar sync with php in 2 ways

I am creating a php website that uses the Google Calendar API. It's working fine with Create, Update and Delete: any event from the PHP website goes into my Google Calendar events after login.
Events created on my site are created in Google Calendar.
What I want now that is: when I create an event from my test page it goes into Google Calendar after login, then if I update or delete that event from Google Calendar then it should automatically update or delete the php website event.
Basically: 1-way sync is working fine but now I want 2-way synchronization.
If anybody has any ideas then kindly share with me, it will be much appreciated.
There are no application hooks in Google Calendar (gCal) that allow you to trigger an action when an event is deleted. Instead you must either poll gCal at intervals (this could be a cron job every few minutes/hours) and update your calendar accordingly, or any time you perform an action from your calendar have a 1 in X possibly of a full re-sync.
This implies that you are using the gCal as the definitive source, and mirroring those changes back to your local application.
well, after following these answers and building a hole 2 way sync process,
i realized there's a push notifications for calendar since 2013.
you will still need a full sync process because the push notification only notifies about a change but no data about the change.
hope it will save you some time.
Push Notifications
Would it not be an option for your system to generate an iCal output at a special, user-specific URL, and then have the user subscribe to that calendar in Google Calendars (or their iCal-reading calendar of choice)?
That way, your system would always hold the authorative calendar, and Google Calendar would reflect any changes you make automatically.
Alternately, if you are wanting changes in the Google Calendar to be reflected in your application, then you may be able to subscribe to iCals for the User's Calendar, and then poll them at a regular interval to reflect any changes the User has made at that end.
I would lean towards the first option (your iCal subscribed through Google Calendar), as it is a simpler and easier solution.

Does the ICS file format allow for updating and deleting events?

We have developed a calendar for our extranet. Each week we update it with next week's courses schedule for all teachers and students of the school. This also triggers the sending per email of ICS files to those users who chose that option.
Now, it almost always happens that there are last minute changes, so a need to do a new schedule update, hence a resend of the updated ICS.
Question: for the moment the user has to manually delete the events already imported into its calendar application. Is there a way for us to add some DELETE or UPDATE events into the user's calendar? Does the ICS format allows that?
Once you get into trying to do updates or deletes (cancel) you are going beyond the iCalendar file format and entering the wonderful world of iCalendar Transport-Independent Interoperability Protocol (iTIP) and iCalendar Message-Based Interoperability Protocol (iMIP) see the Guide to Internet Calendaring tools.ietf.org/html/rfc3283
The best solution will depend on your clients system/s. If you are delivering calendars rather than individual events I would recommend going away from e-mail delivery and using a subscription model. Here is an example of a University doing just that, icalshare.com is another example. Obviously if you wanted personalised timetables you would need personal urls. You could fairly simply just publish the files you are currently sending by email to the web.
If you use the webcal:// instead of http some calendar clients e.g. Outlook 2007 will open it automatically and then keep it updated.
If you don't want to use the subscription model and responses from clients are required I know that Outlook 2007, Windows Live Calendar and Google calendars can all talk iTIP/iMIP to each other, unfortunately I can't find a good list of other clients that do. Apparently Thunderbird 3 was going to but it has been dropped (it will still require the lightening plugin).

Categories