showcio / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
0 stars 0 forks source link

Google Calendar not retrieving any event #376

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.$client = new Google_Client();
2.$cal = new Google_CalendarService($client);
3.$events = $cal->events->listEvents('email address');

What is the expected output? What do you see instead?

I am supposed to get the list of all events on my google calendar in the form 
of an array. Instead, I end up with an empty array the contains no events from 
my google calendar.

What version of the product are you using? On what operating system?
I am using php 5.3 and I am working on windows 8.

Please provide any additional information below.

Below is my code:
<?php

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/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 to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('1025065880500-82g2qf4dj0m6tc72tfaem2d34psepl9u.apps.google
usercontent.com');
$client->setClientSecret('bluCB0ptIq7-DV0Dt92eBIaM');
$client->setRedirectUri('redirect uri');
$client->setDeveloperKey('AIzaSyBY4jVeOjDEFYMv0AJynCZrMw61vBg7YVE');

$cal = new Google_CalendarService($client);

$events = $cal->events->listEvents('email address');

echo $events;

?>

All that is printed out is an empty Array. I also tried to add an event to the 
calendar to see if it was possible but all I end up with is an error that says:

Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error 
calling POST https://www.googleapis.com/calendar/v3/calendars/'email address 
for google 
calendar'/events?key='key'......................................lib/google-api-p
hp-client/src/io/Google_REST.php on line 66

Original issue reported on code.google.com by kenshine...@gmail.com on 23 Aug 2013 at 10:45