Google通讯录广播/推送/通知/挂钩API [英] Google Contacts Broadcast/Push/Notification/Hook API

查看:176
本文介绍了Google通讯录广播/推送/通知/挂钩API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法,可以在Google上的联系人被编辑,删除或创建时接收来自Google的通知/广播。



我通过Google Contacts API文档,但找不到任何东西。



我认为必须有一种方法,例如Android确实不会调查更改。

解决方案

Google Contacts API文档没有提及任何有关Web钩子Google日历API有。



我认为您可能需要做的事情如下:


  1. 设置数据库以存储联系人的信息。

  2. 创建一个PHP脚本,该脚本将向Google联系人查询联系人的更新信息
    a。使用PHP的curl函数连接到Google Contacts API查询链接。
    b。将脚本设置为发送Google Contacts API请求的凭据。
    c。将从Google Contacts API中读取的联系人信息与存储在数据库中的该联系人信息进行比较。如果信息不同,请更新您的数据库。

  3. 将脚本设置为定期运行:

    a。如果使用Linux - 将服务器的Cron函数设置为在特定时间运行脚本。

    - 或 -

    b。如果使用Windows - 设置Windows Task Scheduler在特定时间运行脚本(或批处理文件和脚本)。 。参阅这个链接以获得关于使用PHP设置MySql数据库的教程 http://www.w3schools。 (2)a。查看这个链接,了解关于PHP curl的教程
    wiki.dreamhost.com/CURL_PHP_tutorialrel =nofollow> http://wiki.dreamhost.com/CURL_PHP_tutorial

    (2. b。 https://开发人员查看联系人详情.google.com / google-apps / contacts / v3 /#retrieveting_contacts_using_query_parameters

    (b。请参阅此链接了解如何在PHP中使用OAuth ,这将需要连接到Google Contacts API http://php.net/manual/en/book.oauth.php



    (3。有关Linux cron的详细信息,请参阅此链接。 http://www.thegeekstuff。 com / 2009/06/15-practical-crontab-examples /

    (3。查看此链接以查看如何运行PHP脚本与批处理文件和Windows任务计划程序 http://www.codingforums.com /archive/index.php/t-198431.html



    此致,

    mnutsch

    I am looking for a way to receive notifications / broadcasts from google when a contact on googles side is edited, deleted or created.

    I looked through the Google Contacts API documentation but could not find anything..

    I think there must be a way, e.g. Android for sure does not poll for changes.

    解决方案

    The Google Contacts API documentation doesn't mention anything about a web hook like the Google Calendar API has.

    I think that what you might have to do is the following:

    1. Set up a database to store your contact's info.
    2. Create a PHP script which will query Google Contacts for the contact's updated info a. Use PHP's curl function to connect to Google Contacts API query link. b. Set the script to send the credentials requested by Google Contacts API. c. Compare the contact's information read from the Google Contacts API against the information on that contact stored in your database. If the information is different then update your database.
    3. Set your script to run periodically:
      a. If using Linux - Set your server's Cron function to run the script at certain times.
      -or-
      b. If using Windows - Set Windows Task Scheduler to run the script (or a batch file and the script) at certain times.

    (1. see this link for a tutorial on setting up a MySql database with PHP http://www.w3schools.com/PHP/php_mysql_intro.asp)

    (2. a. see this link for a tutorial on PHP curl http://wiki.dreamhost.com/CURL_PHP_tutorial)

    (2. b. see this link for Google Contacts API details on querying a contact's info https://developers.google.com/google-apps/contacts/v3/#retrieving_contacts_using_query_parameters)

    (2. b. see this link for details on using OAuth in PHP, which will be needed to connect to Google Contacts API http://php.net/manual/en/book.oauth.php)

    (3. see this link for details on Linux cron http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/)

    (3. see this link for an example on how to run a PHP script with a batch file and Windows Task Scheduler http://www.codingforums.com/archive/index.php/t-198431.html)

    Sincerely,

    mnutsch

    这篇关于Google通讯录广播/推送/通知/挂钩API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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