“Google Calendar API Push Notificaciones PHP” Código de respuesta

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

Respuestas similares a “Google Calendar API Push Notificaciones PHP”

Preguntas similares a “Google Calendar API Push Notificaciones PHP”

Más respuestas relacionadas con “Google Calendar API Push Notificaciones PHP” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código