整合我的网站与谷歌日历 [英] Integrate my website with google calendar

查看:113
本文介绍了整合我的网站与谷歌日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在PHP中开发一个网站。本网站的用户可以从我提供的日历中预约预约。当用户进行预订时,应将其添加到我的Google日历中。

这种类型的场景需要什么样的认证机制?哪一个来自以下?
1. Web应用程序
2.服务帐户
3.已安装的应用程序



注意:我不想访问我的网站用户的谷歌日历。我只想让他们的预订显示在我的Google日历中。并且,如果可能的话,请发布我可以开始编码的来源。我搜索了这个主题的大多数教程都是基于.NET的。



谢谢。

解决方案

您需要使用 Google Calendar API 设置OAuth界面>。但是,您不必使用OAuth连接到用户的Google日历,而是将其设置为始终连接到您的Google日历。如果您进入Google日历API文档,则会有一个名为编写您的第一个应用程序。这有多种语言的示例代码,包括PHP。这是一个开始的好地方。



注意:当我说它会使用您的帐户时,我的意思是您将它设置为像您是客户一样,并且连接通过OAuth获取令牌。然后保存这些令牌并将其用于Google日历的所有访问。由于代币已加入您的帐户,因此您将始终连接到您的日历。


Im developing a website in PHP. The users of this site are allowed to book appointments from the calendar that i have provided. When a user makes a booking it should be added to my google calendar.

What kind of authentication mechanism would i need for this type of scenario? Which one from the following? 1. Web applications 2. Service accounts 3. Installed applications

NB: I dont want to access my site user's google calendar. I just want their booking be shown in my google calendar. And, if possible, please post a source where i can get started on the coding. I searched but most tutorials on this topic are based on .NET.

Thanks.

解决方案

You will need to setup an OAuth interface with the Google Calendar API. But instead of using OAuth to connect to the user's Google Calendar, you will set it up so that it always connects to your Google Calendar. If you go into the Google Documentation for the Calendar API, they have section called Write your First App. This has sample code in multiple languages including PHP. It's a good place to start.

NOTE: When I say that it will use your account, what I mean is that you set it up like you are a customer and connect via OAuth to get the tokens. Then save those tokens and use them for all accesses to Google Calendar. Since the tokens are into your account, you will always be connecting to your Calendar.

这篇关于整合我的网站与谷歌日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆