Google -Kalender -API -Push -Benachrichtigungen PHP
$url = sprintf("https://www.googleapis.com/calendar/v3/calendars/%s/events/watch", $calendar);
/* setup the POST parameters */
$fields = json_encode(array(
'id' => "some_unique_key",
'type' => "web_hook",
'address' => sprintf("http://%s//event_status/update_google_events", $_SERVER['SERVER_NAME'])
));
/* setup POST headers */
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer ' . $access_token;
/* send POST request */
$channel = curl_init();
curl_setopt($channel, CURLOPT_HTTPHEADER, $headers);
curl_setopt($channel, CURLOPT_URL, $url);
curl_setopt($channel, CURLOPT_RETURNTRANSFER, true);
curl_setopt($channel, CURLOPT_POST, true);
curl_setopt($channel, CURLOPT_POSTFIELDS, $fields);
curl_setopt($channel, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($channel, CURLOPT_TIMEOUT, 3);
$response = curl_exec($channel);
curl_close($channel);
error_log($response);
Brainy Barracuda