php - Google API / Calendar : can't find a way to use google api -
i'm trying utilize google calendar api , php client library create php function add together event variables give through parameters.
but seems documentation outdated, , can't find tutorial help me. here i've done moment :
<?php require_once 'google-api-php-client/autoload.php'; session_start(); //require_once 'google-api-php-client/src/google/client.php'; //require_once 'google-api-php-client/src/google/service/calendar.php'; $client = new google_client(); $client->setapplicationname("test"); $client->setclientid("xxxx.apps.googleusercontent.com"); $client->setclientsecret("xxxx"); $client->setredirecturi("http://localhost/"); $client->setdeveloperkey("xxxx"); $service = new google_service_calendar($client); $event = new google_service_calendar_event(); $event->setsummary('appointment'); $event->setlocation('somewhere'); $start = new google_service_calendar_eventdatetime(); $start->setdatetime('2014-10-16t10:00:00.000-07:00'); $event->setstart($start); $end = new google_service_calendar_eventdatetime(); $end->setdatetime('2014-10-16t10:25:00.000-07:00'); $event->setend($end); /*$attendee1 = new eventattendee(); $attendee1->setemail('attendeeemail'); $attendees = array($attendee1, // ... ); $event->attendees = $attendees;*/ $createdevent = $service->events->insert('primary', $event); echo $createdevent->getid(); ?>
and browser tells me :
fatal error: uncaught exception 'google_service_exception' message 'error calling post https://www.googleapis.com/calendar/v3/calendars/primary/events?key=xxxx: (401) login required' in c:\wamp\www\cnsi\google-api-php-client\src\google\http\rest.php on line 76
could help me please ?
i recommend used libraries of zend framework it.
checkout http://framework.zend.com/manual/1.12/en/zend.gdata.calendar.html
php api calendar google-api google-api-php-client
No comments:
Post a Comment