0

Zend_Gdata_Photos PHP クライアントを使用して Google Picasa API にアクセスし、非常に単純なことをして、すべてのアルバムを一覧表示し、次に各アルバム内のすべての写真を一覧表示しようとしています。これは私のコードです:

$client = Zend_Gdata_ClientLogin::getHttpClient('*****', '*****', Zend_Gdata_Photos::AUTH_SERVICE_NAME);
$gp = new Zend_Gdata_Photos($client);

$userFeed = $gp->getUserFeed('default');
foreach ($userFeed as $albumEntry) {
 echo "<h2>{$albumEntry->title->text} ({$albumEntry->id->text})</h2>";
 $albumFeed = $gp->getAlbumFeed($albumEntry->id->text);
 foreach ($albumFeed as $photoEntry) {
  echo "{$photoEntry->title->text}<br>";
 }
}

それが実行されると、 $gp->getAlbumFeed(...) 行から次の例外が発生します。

Zend_Gdata_App_Exception: No root  element

そして、アイデアは私が間違っていることですか?

4

1 に答える 1

0

まあ、私は自分がやりたいことをする方法を理解していませんでしたが、同じことをする別の方法を見つけました:

$query = new Zend_Gdata_Photos_UserQuery();
$userFeed = $gp->getUserFeed(null, $query);
foreach ($userFeed as $albumEntry) {
    $query = new Zend_Gdata_Photos_AlbumQuery();
    $query->setAlbumId($albumEntry->gphotoId->text);
    $albumFeed = $gp->getAlbumFeed($query);
    foreach ($albumFeed as $photoEntry) {
        // ...
    }
}
于 2010-08-08T09:48:39.933 に答える