2012-11-05 146 views
0

我在Google日历中拥有2个或更多日历。在这样一个字符串PHP Google日历从特定日历中获取活动

[...] 
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); 
$service = new Zend_Gdata_Calendar($client); 

//Set up that loop again to find the new calendar: 
$calFeed = $service->getCalendarListFeed(); 
foreach ($calFeed as $calendar) { 
    if($calendar->title->text == "Calendar2") 
     $appCalUrl = $calendar->content->src; 
    } 
} 
[...] 

try { 

    $event   = $service->newEventEntry(); 
    $event->title = $service->newTitle($title); 

    $when   = $service->newWhen(); 
    $when->startTime = $start; 
    $when->endTime = $end; 

    $event->when  = array($when); 
    $newEvent  = $service->insertEvent($event, $appCalUrl); 

    // fetch URI for edit, delete 
    $uri = $newEvent->id->text; 

} catch (Zend_Gdata_App_Exception $e) { 
    echo "Error: " . $e->getResponse(); 
} 

$ URI结果: 我可以添加事件到特定的日历像 http://www.google.com/calendar/feeds/7b06drcai3lhc4lhhb0lgvv7sk%40group.calendar.google.com/private/full/ndp7g62tbbvknhi8bbhh9jfu9o

然后,使用:

try { 

    $title = "test2"; 
    $event = $service->getCalendarEventEntry($uri); 
    $event->title = $service->newTitle($title); 
    } catch (Zend_Gdata_App_Exception $e) { 
    die("Error: " . $e->getResponse()); 
} 

这总是导致这样的错误:坏/无效的URI

我一直在寻找,在多个例子中都说URI格式应该是一些像这样的东西:

getCalendarEventEntry('http://www.google.com/calendar/feeds/default/private/full/' . $id); 

只获得ID不工作。有任何想法吗?

回答

0

实测值的awnser:

的字符串的格式为:

http://www.google.com/calendar/feeds/$calendar_id%40group.calendar.google.com/private/full/$event_id