Google Calendar syncs with php in two ways

I am creating a php site that uses the google calendar API. It works great with Create, Update, and Delete: any event from the PHP website goes to my events in Google Calendar after logging in.

Events created on my site are created on Google Calendar.

Now I want: when I create an event from my test page, it goes to Google Calendar after logging in, and then, if I update or delete this event from Google Calendar, it should automatically update or delete the php website event.

Basically: one-way synchronization works fine, but now I want two-way synchronization.

If anyone has any ideas, then kindly share with me, it will be very grateful.

+7
source share
3 answers

Google Calendar (gCal) does not have application hooks that allow you to trigger an action when an event is deleted. Instead, you should either try gCal at intervals (this can be a cron job every few minutes / hours), and update your calendar accordingly, or at any time when you perform an action from your calendar, there is 1 in X, possibly full re-sync.

This means that you are using gCal as the final source and mirror these changes back to the local application.

+5
source

Will your system generate iCal output on a special URL of the user, and then subscribe to this calendar in Google Calendar (or in the iCal reading calendar)?

Thus, your system will always store an authorized calendar, and Google Calendar will reflect any changes you make.

Alternatively, if you want changes to the Google Calendar reflected in your application, you can subscribe to iCals for the User Calendar and then poll them at regular intervals to reflect any changes the user has made for this purpose.

I would lean to the first option (your iCal signed up through Google Calendar), since this is a simpler and simpler solution.

+1
source

well, after completing these answers and building a two-way synchronization process with holes, I realized that since 2013 you can receive frame notifications. you still need the full synchronization process, because the push notification notifies you of the change only, but no data about this change. Hope this saves you some time.

Push notifications

+1
source

All Articles