2011-09-09 15 views
0

私はGoogleの連絡先「イベント」(すなわち:記念日のetct)に基づいて情報を取得しようとしています。Google Contacts API - イベントデータの選択

です。私は短縮された整理された形式でデータのいくつかを得ることができました。 これは私がこの情報を得るために取り組んでいるXMLです。

[13] =>だから私は、私がこれまでのところ、このコードを使用するイベントのタイプを取得するためにやっていること

a_App_Extension_Element Object 
     (
      [_rootElement:protected] => event 
      [_extensionElements:protected] => Array 
       (
        [0] => Zend_Gdata_App_Extension_Element Object (
          [_rootElement:protected] => when 
          [_extensionAttributes:protected] => Array (
            [startTime] => Array (
              [namespaceUri] => 
              [name] => startTime 
              [value] => 2009-05-09)) 
          [_text:protected] => 
         ) 
       ) 

      [_extensionAttributes:protected] => Array (
        [rel] => Array (
          [namespaceUri] => 
          [name] => rel 
          [value] => anniversary)) 
      [_text:protected] => 
     ) 

Zend_Gdat。

// Get All Events 
foreach ($xml->event as $e) {      
    if($e['rel'] == "anniversary") { 
     // echo "This is true, this is anniversary"; 
    } 
} 

実際のイベントVALUE(開始時刻)を取得します。私はこのようなものを各ループの中で実行すると思っていました。

foreach ($xml->event as $e) {      
    echo $e->when['startTime']; 
} 

しかし、これはちょうどエコーです。 私は多くのバリエーションを試しましたが、それを得るようには見えませんが、それはちょうど私の過度の疲れによるものかどうかはわかりません。どんな助けでも大歓迎です!

答えて

0

私は解決策を見つけることができました。

// Get All Events 
foreach ($xml->event as $e) { 
    $defaults = $e->children('http://schemas.google.com/g/2005'); 

    if($e['rel'] == "anniversary") { 
     $obj->anniversary = (string) $defaults->when->attributes()->startTime; 
    } 
} 
関連する問題