我想使用google api v3 freebusy(php)來查找我的三個日曆的免費freebusy信息,但是我找不到我的代碼的正確結尾。我想訪問$ freebusy-response的「日曆 - 繁忙」值。如何完成此Google Calendar Api v3 - FreeBusy PHP - 示例?
由於api-reference中沒有示例代碼,我無法在網上找到任何工作代碼(但很多人都在問這個問題),你們是我最後的希望。
...
$service = new Google_CalendarService($client); // successfully connected
$freebusy = new Google_FreeBusyRequest();
$freebusy->setTimeMin('2013-07-08T08:00:00.000-07:00');
$freebusy->setTimeMax('2013-07-08T10:00:00.000-07:00');
$freebusy->setTimeZone('Europe/Berlin');
$freebusy->setGroupExpansionMax(10);
$freebusy->setCalendarExpansionMax(10);
$mycalendars= array("[email protected]","[email protected]","[email protected]");
$freebusy->setItems = $mycalendars;
$createdReq = $service->freebusy->query($freebusy);
echo $createdReq->getKind(); // works
echo $createdReq->getTimeMin(); // works
echo $createdReq->getTimeMax(); // works
$s = $createdReq->getCalendars($diekalender);
Print_r($s, true); // doesn't show anything
// needed: the value of "calendars": { (key): { "busy" - array of one or all calendars
這是API參考說,有關的反應是什麼:
{
"kind": "calendar#freeBusy",
"timeMin": datetime,
"timeMax": datetime,
"groups": {
(key): {
"errors": [
{
"domain": string,
"reason": string
}
],
"calendars": [
string
]
}
},
"calendars": {
(key): {
"errors": [
{
"domain": string,
"reason": string
}
],
"busy": [
{
"start": datetime,
"end": datetime
}
]
}
}
}
請勿發佈代碼圖片。寫在這裏,讓人們可以看到它,並在需要時複製它。此外,請解釋您的答案如何解決問題(編輯答案並添加更多詳細信息) – Takarii