“Google -Kalender -API -Push -Benachrichtigungen PHP” Code-Antworten

Google -Kalender -API -Push -Benachrichtigungen 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 -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

Ähnliche Antworten wie “Google -Kalender -API -Push -Benachrichtigungen PHP”

Fragen ähnlich wie “Google -Kalender -API -Push -Benachrichtigungen PHP”

Weitere verwandte Antworten zu “Google -Kalender -API -Push -Benachrichtigungen PHP” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen