Google通知API确认


Google Notification API acknowledgment

我已经在我的服务器上启用了Google日历推送通知API。一切都很好,我只差最后一盘。这是返回谷歌的确认,我已经收到了消息,一切都很好。我知道我必须返回一个确认值200,但我不知道如何在google-api-php-client中做到这一点。

$client = new Google_Client();
$client->setClientId($client_id);
$client->setDeveloperKey($developer_key);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->addScope("https://www.googleapis.com/auth/drive");
$client->addScope("https://www.googleapis.com/auth/calendar");
$client->setAccessType('offline');  
$refresh_token = $user['refresh_token'];
$client->refreshToken($refresh_token);  

$service = new Google_Service_Calendar($client);

这是我使用的代码的一部分

响应码为默认值200。另一种选择是使用http_response_code(200)或使用框架提供的任何内容显式设置它。在google-api-php-client中没有特殊的代码可以为你接收通知。