Login   Register  
PHP Classes
elePHPant
Icontem

Google-Calendar

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  Google-Calendar  >  (Un) Subscribe thread alerts  
Subject:Google-Calendar
Summary:Connect with Google_Kalender
Messages:18
Author:Schenk Philipp
Date:2012-11-14 13:26:36
Update:2012-11-21 02:56:27
 
  1 - 10   11 - 18  

  11. Re: Google-Calendar   Reply   Report abuse  
Picture of Schenk Philipp
Schenk Philipp
2012-11-18 21:55:25 - In reply to message 10 from Manuel Lemos
I have the line:
$ success = $ client-> CallAPI (
'https://www.googleapis.com/calendar/v3/calendars/me/event'
'GET', array (), array ('FailOnAccessError' => true), $ user);

and the code for the insert of the event:

Where do I insert the code?
It does not work:

/* API permissions */

$client->scope = 'https://www.googleapis.com/auth/calendar '.
'https://www.googleapis.com/auth/userinfo.profile';



if(($success = $client->Initialize()))
{
if(($success = $client->Process()))
{
if(strlen($client->authorization_error))
{
$client->error = $client->authorization_error;
$success = false;
}
elseif(strlen($client->access_token))
{


$success = $client->CallAPI(
'https://www.googleapis.com/calendar/v3/calendars/mymail@gmail.com/events',
'GET', array(), array('FailOnAccessError'=>true), $user);



$event = new Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');

$start = new EventDateTime();
$start->setDateTime('2012-11-18T10:00:00');
$event->setStart($start);

$end = new EventDateTime();
$end->setDateTime('2012-12-18T10:30: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();


}
}
$success = $client->Finalize($success);
}
if($client->exit)
exit;
if($success)
{

?>


Do you have an idea we could fumktionieren it?

  12. Re: Google-Calendar   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-11-18 23:34:22 - In reply to message 11 from Schenk Philipp
"It does not work" is a vague statement. You need to be more explicit and tell exactly what happen so I can figure what is the problem.

The call to API URL https://www.googleapis.com/calendar/v3/calendars/me/event gets the calendar events of the user that gave permission to access the API.

You cannot request access to the calendar of any other user. So you should not replace me by mymail@gmail.com . Do not change the me part in the API URL.

  13. Re: Google-Calendar   Reply   Report abuse  
Picture of Schenk Philipp
Schenk Philipp
2012-11-19 10:45:21 - In reply to message 12 from Manuel Lemos
The appointment is not stored in my calendar. The PHP code seems to be wrong.
The browser brings the error message: The page can not be displayed.

I mymail@gmail.com eingefŁen instead of my email address. The dates are in my calendar. (where I also had the privilege)

to ask what should I insert the code so that it can run without error?

or is the code to create an event that wrong?

  14. Re: Google-Calendar   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-11-19 11:40:58 - In reply to message 13 from Schenk Philipp
Maybe you have a syntax error in your PHP code.

  15. Re: Google-Calendar   Reply   Report abuse  
Picture of Schenk Philipp
Schenk Philipp
2012-11-19 23:11:39 - In reply to message 14 from Manuel Lemos
Is new Event (); possible with PHP OAuth API class?

I have in my code: new Event ();
==> Event is not a PHP object.

  16. Re: Google-Calendar   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-11-20 01:23:00 - In reply to message 15 from Schenk Philipp
What is that Event class? Is that class defined anywhere in your code?

The OAuth class does not interfere with any other classes.

  17. Re: Google-Calendar   Reply   Report abuse  
Picture of Schenk Philipp
Schenk Philipp
2012-11-20 22:39:18 - In reply to message 16 from Manuel Lemos
Do I need OAuth API with PHP because the google-api-php-client as well?

  18. Re: Google-Calendar   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2012-11-21 02:56:27 - In reply to message 17 from Schenk Philipp
I think you need first to understand your problem.

You seem to be trying to use classes like those named Event that have nothing to do with OAuth. Where are those classes defined? Why did you decide to use them?

All you need to access Google APIs is to obtain authorization via OAuth and send API requests to the URLs documented in Google Calendar API pages. You should not need any other classes.

 
  1 - 10   11 - 18