php - php 中的 Google 日历推送通知监视命令

标签 php google-api-php-client

我正在使用 php watch 命令:

$service = new Google_Service_Calendar($client);


$channel =  new Google_Service_Calendar_Channel($client);
$channel->setId('20fdedbf0-a845-11e3-1515e2-0800200c9a6689111');
$channel->setType('web_hook');
$channel->setAddress('https://www.exampel.com/app/notification');

$watchEvent = $service->events->watch('primary', $channel);

此命令运行良好,我得到响应:

Google_Service_Calendar_Channel Object ( [address] => [expiration] => 1401960485000 [id] => 20fdedbf0-a845-11e3-1515e2-0800200c9a6689111 [kind] => api#channel [params] => [payload] => [resourceId] => HZjSdbhwcd5KMKEA3ATA31LoR-w [resourceUri] => https://www.googleapis.com/calendar/v3/calendars/primary/events?key=AIzaSyBl_Y7Y4eQDve-0DjwzBEP7_qOLo-67ouY&alt=json [token] => [type] => [modelData:protected] => Array ( ) [processed:protected] => Array ( ) ) 

但是;在我设置的网址中,当我的日历发生变化时,我不会收到任何消息。 我错过了什么吗!?

最佳答案

我有一个类似的问题,这是由我的应用程序上的身份验证引起的。

尝试向 https://www.exampel.com/app/notification 发送 post 请求并查看是否收到。如果不是,请仔细检查您的路由或身份验证。

关于php - php 中的 Google 日历推送通知监视命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23930262/

相关文章:

javascript - 单击按钮时设置 session 变量

php - 使用 PHP 生成/复制 HTML

google-drive-api - 如何从 Google Drive REST api v3 获取共享链接?

php - 使用 PHP 连接到 Google Analytics API

php - 谷歌服务帐户示例返回 "Error refreshing the OAuth2 token { “error” : “invalid_grant” }"

php - 如何在 PHP 中修剪 heredoc(长字符串)中的每一行

php - 无法在 Phabricator 中上传文件

PHP编辑百分比

php - 如何正确使用 facebook scope 获取用户邮箱?