“Google Calendar API Push Notifications PHP” Réponses codées

Google Calendar API Push Notifications PHP

$channel = new Google_Service_Calendar_Channel($client);
$channel->setId('00000000-0000-0000-0000-000000000001');
$channel->setType('web_hook');
$channel->setAddress('https://www.yourserver.com/handleWatch.php');
$watchEvent = $service->events->watch(yourCalendarId, $channel, array());
Brainy Barracuda

Google Calendar API Push Notifications 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

Réponses similaires à “Google Calendar API Push Notifications PHP”

Questions similaires à “Google Calendar API Push Notifications PHP”

Plus de réponses similaires à “Google Calendar API Push Notifications PHP” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code