php - Does this even work with v3? No Documentation -


so have been spending couple hours trying figure out how google calendars work. v3 has no calendar examples, guess found older git has simple.php example. entered client id, secret, redirect, , api key.

i browse simple.php page , asks authorization, redirects , shows calendar list array of bunch of random stuff not related calendar @ all.

how show in actual calendar? why isn't there documentation on this?

i trying google calendar display on webpage user logged in. figured there have been lot of documentation this. not possible using google api?

<?php require_once '../../src/google_client.php'; require_once '../../src/contrib/google_calendarservice.php'; session_start();  $client = new google_client(); $client->setapplicationname("google calendar php starter application");  // visit https://code.google.com/apis/console?api=calendar generate // client id, client secret, , register redirect uri. $client->setclientid('myclientid'); $client->setclientsecret('myclientsecret'); $client->setredirecturi('http://localhost/wordpress/wp-content/themes/twentyfourteen/google-api-php-client/examples/calendar/simple.php'); $client->setdeveloperkey('myapikey'); $cal = new google_calendarservice($client); if (isset($_get['logout'])) {   unset($_session['token']); }  if (isset($_get['code'])) {   $client->authenticate($_get['code']);   $_session['token'] = $client->getaccesstoken();   header('location: http://' . $_server['http_host'] . $_server['php_self']); }  if (isset($_session['token'])) {   $client->setaccesstoken($_session['token']); }  if ($client->getaccesstoken()) {   $callist = $cal->calendarlist->listcalendarlist();   print "<h1>calendar list</h1><pre>" . print_r($callist, true) . "</pre>";    $calendar = $service->calendars->get('primary');   echo $calendar->getsummary();   $_session['token'] = $client->getaccesstoken(); } else {   $authurl = $client->createauthurl();   print "<a class='login' href='$authurl'>connect me!</a>"; } 

which gets me

calendar list array (     [kind] => calendar#calendarlist     [etag] => "uz4dsmpawpogj1sir_pp7gm-axy/dkoq7akw5rqpry2qgnrzso6dywq"     [items] => array         (         [0] => array             (                 [kind] => calendar#calendarlistentry                 [etag] => "uz4dsmpawpogj1sir_pp7gm-axy/ofdipqtoizbq0xum55ch-rimgw4"                 [id] => myemailaddress                 [summary] => myemailaddress                 [timezone] => america/los_angeles                 [colorid] => 15                 [backgroundcolor] => #9fc6e7                 [foregroundcolor] => #000000                 [selected] => 1                 [accessrole] => owner                 [defaultreminders] => array                     (                         [0] => array                             (                                 [method] => email                                 [minutes] => 10                             )                          [1] => array                             (                                 [method] => popup                                 [minutes] => 30                             )                      )                  [notificationsettings] => array                     (                         [notifications] => array                             (                                 [0] => array                                     (                                         [type] => eventcreation                                         [method] => email                                     )                                  [1] => array                                     (                                         [type] => eventchange                                         [method] => email                                     )                                  [2] => array                                     (                                         [type] => eventcancellation                                         [method] => email                                     )                                  [3] => array                                     (                                         [type] => eventresponse                                         [method] => email                                     )                              )                      )                  [primary] => 1             )          [1] => array             (                 [kind] => calendar#calendarlistentry                 [etag] => "uz4dsmpawpogj1sir_pp7gm-axy/sjfvolvft6eclqqbcedo4swexfc"                 [id] => #contacts@group.v.calendar.google.com                 [summary] => contacts' birthdays , events                 [description] => contacts' birthdays , anniversaries                 [timezone] => america/los_angeles                 [colorid] => 17                 [backgroundcolor] => #9a9cff                 [foregroundcolor] => #000000                 [selected] => 1                 [accessrole] => reader             )          [2] => array             (                 [kind] => calendar#calendarlistentry                 [etag] => "uz4dsmpawpogj1sir_pp7gm-axy/r5pe_cdz8mqz0fmwnfeci-di2wo"                 [id] => en.usa#holiday@group.v.calendar.google.com                 [summary] => holidays in united states                 [description] => holidays in united states                 [timezone] => america/los_angeles                 [colorid] => 9                 [backgroundcolor] => #7bd148                 [foregroundcolor] => #000000                 [selected] => 1                 [accessrole] => reader             )      )  ) notice: undefined variable: service in c:\xampp\htdocs\wordpress\wp-content\themes\twentyfourteen\google-api-php-client\examples\calendar\simple.php on line 33  notice: trying property of non-object in c:\xampp\htdocs\wordpress\wp-content\themes\twentyfourteen\google-api-php-client\examples\calendar\simple.php on line 33  fatal error: call member function get() on non-object in c:\xampp\htdocs\wordpress\wp-content\themes\twentyfourteen\google-api-php-client\examples\calendar\simple.php on line 33 

i guess wanna next list events in calendar. https://developers.google.com/google-apps/calendar/v3/reference/events/list

you can choose want calendars or events in reference , can find php example on end of each page.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -