phpzend-frameworkzend-gdata

How do I insert into non-default Google Calendar using Zend / PHP


I'm trying to insert a new event into Google Calendar, which I can do fine by the following:

$sname = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($userName,$password,$sname);
$service = new Zend_Gdata_Calendar($client);

$event = $service->newEventEntry();
$event->title = $service->newTitle($name);
$event->when = array($when);
$newEvent = $service->insertEvent($event);

However, this will only insert into the default calendar. I am trying to use the URI argument of insertEvent to get where I need to go:

$uri = "http://www.google.com/calendar/feeds/default/something@somethingelse.com/private/full";
$newEvent = $service->insertEvent($event, $uri);

This hasn't worked. I've tried encoding and decoding the URI, which gives me different error messages, but I just can't get this to work. I've been Googling solutions for hours now with no luck. Can anyone help?

Thanks. - Dave


Solution

  • Found the issue: The URI above doesn't work: "http://www.google.com/calendar/feeds/default/something@somethingelse.com/private/full";

    should not have the default section there.

    Also, the @ sign should be replaced by encoding. So it should be: "http://www.google.com/calendar/feeds/something%40somethingelse.com/private/full";