如何使用RSS Feed从Picasa获取Picasa图像

时间:2014-03-17 16:18:51

标签: php xml rss picasa

我使用此代码从我的帐户picasa获取所有图片,但没有结果:

$content = file_get_contents("https://picasaweb.google.com/data/feed/base/user/107745136468823194427?alt=rss&kind=photo&hl=fr&imgmax=1600");
$x = new SimpleXmlElement($content);
foreach($x->channel->item as $entry => $value){

    $title  = $value->title;
    $image  = $value->enclosure->attributes()->url;
    $urlimg = $image[0];
    echo '<img src="'.$urlimg.'>"';
}

有什么问题?感谢

1 个答案:

答案 0 :(得分:0)

请试试这段代码吗?

<?php 
$content = file_get_contents("https://picasaweb.google.com/data/feed/base/user/107745136468823194427?alt=rss&kind=photo&hl=fr&imgmax=1600");
$x = simplexml_load_string($content);
foreach($x->channel->item as $entry => $value){

    $title  = $value->title;
    $image  = $value->enclosure->attributes()->url;
    $urlimg = $image[0];
    echo '<img src="'.$urlimg.'>"';
}