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 回答