2012-10-11 62 views
1

我在我的網站上有一個嵌入式壓光機,我期待允許用戶將事件添加到日曆中,我將如何使用PHP進行此操作?用戶將數據插入到Google Calender PHP

我已經看過了谷歌API文檔,但無法理解如何實現他們的榜樣,見下圖:

$calendarListEntry = new CalendarListEntry(); 
$calendarListEntry->setId("calendarId"); 

$createdCalendarListEntry = $service->calendarList->insert($calendarListEntry); 

echo $createdCalendarListEntry->getSummary(); 

目前我的代碼看起來是這樣的;

<?php 
    require_once '../google-api-php-client/src/Google_Client.php'; 
    require_once '../google-api-php-client/src/contrib/Google_CalendarService.php'; 
    $calendarListEntry = new CalendarListEntry(); 
    $calendarListEntry->setId("[email protected]"); 
    $createdCalendarListEntry = $service->calendarList->insert($calendarListEntry); 
    echo $createdCalendarListEntry->getSummary(); 
?> 

回答