我有来自flikr的RSS源
在这里有一个媒体:description,media:thumbnail e.t.c
我正在努力从媒体上获取网址:缩略图,但我没有运气!
我的代码......
$content = file_get_contents("http://api.flickr.com/services/feeds/photoset.gne?set=72157629920039099&nsid=50910794@N07&lang=en-us&format=rss_200");
$x = new SimpleXmlElement($content);
$ourItems = "";
foreach($x->channel->item as $entry) {
$thumbParent = $entry->children("media");
$thumb = $thumbParent->thumbnail->attributes();
$thumbW = $thumb['width'];
$thumbH = $thumb['height'];
$thumbURL = $thumb['url'];
$ourItems .= "<li>\n"
."<a href='$entry->link' title='$entry->title'>\n"
."<img src='" . $thumbURL . "' />\n"
."</a>\n"
."</li>\n";
}
return $ourItems;
请有人指出我正确的方向 - 谢谢!
答案 0 :(得分:0)
尝试使用儿童功能:
$thumbA = $item->children('media', true)->thumbnail->attributes();
<media:thumbnail url="<?php echo ($thumbA['url']); ?>" />