2012-11-05 174 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