2012-03-27 29 views
1

在我的代碼中,我向Google日曆添加了一個事件。一切都很好,除了沒有存儲的地方的價值。未保存Google日曆中的哪個位置的值

這是我用來將事件添加到Google日曆的教程的鏈接。

http://mark.biek.org/blog/2010/07/addingdeleting-events-with-the-google-calendar-api/

這是我使用的代碼:

<?php 
    include('includes/class1.php'); 
    include('includes/class2.php'); 
    define("APP_NAME", "MY APP"); 
    $email = "[email protected]"; 
    $password = "test"; 
    $altEmail = "[email protected]"; 
    $login = new GoogleClientLogin($email, $password, GoogleClientLogin::$CALENDAR_SERVICE, APP_NAME); 

    $cal = new GoogleCalendar($login); 
    $cal->altEmail = $altEmail; 

    $entryData = $cal->addEvent(array( 
        "title"=> "Auto Test event", 
        "content"=> "This is a test event", 
        "where"=> "Test location", 
        "startTime"=> time(), 
      "endTime"=> time() 
       )); 
    print_r($entryData);  
?> 

增加成功的事件,但位置不保存。我的代碼有什麼問題?

class1.phpclass2.php從以上鍊接下載。

回答

0

在class1.php,也有這樣的代碼:

$xml = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005"> 
        <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event"></category> 
        <title type="text">'.$params["title"].'</title> 
        <content type="text">'.$params["content"].'</content> 
        <gd:transparency value="http://schemas.google.com/g/2005#event.opaque"> 
        </gd:transparency> 
        <gd:eventstatus value="http://schemas.google.com/g/2005#event.confirmed"> 
        </gd:eventstatus> 
        <gd:where valuestring="'.$params["where"].'"></gd:where> 
        <gd:when endTime="'.$params["endTime"].'" startTime="'.$params["startTime"].'"/> 
       </entry>'; 

這裏改變如下:

<gd:where valueString="'.$params["where"].'"/> 

然後將存儲的位置也