我需要从此 rss 提要中获取图片网址。我正在使用 dom 文档获取数据
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>
<title><![CDATA[Accessories]]></title>
<link>http://abcde.com/accessories</link>
<description><![CDATA[Accessories]]></description>
<pubDate>Fri, 08 Feb 2013 10:16:45 +0000</pubDate>
<generator>Zend_Feed</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<item>
<title><![CDATA[Jabra HALO 2 JBRA2113 Wireless Headset]]></title>
<link>http://abcde.com/accessories/jabra-halo-2-jbra2113-wireless-headset</link>
<description><![CDATA[<table><tr><td><a href="http://abcde.com/accessories/jabra-halo-2-jbra2113-wireless-headset"><img src="http://abcde.com/media/catalog/product/cache/1/thumbnail/75x75/9df78eab33525d08d6e5fb8d27136e95/h/a/halo2_frontview_1440x810.jpg" border="0" align="left" height="75" width="75"></a></td><td style="text-decoration:none;">
<div class="price-box">
<span class="regular-price" id="product-price-1041"><span class="price">Rs. 6,499.00</span></span>
</div>
</td></tr></table>]]></description>
<pubDate>Fri, 08 Feb 2013 10:16:45 +0000</pubDate>
</item>
</channel>
</rss>
预期输出:
现在我得到这样的细节......
$doc = new DOMDocument();
$doc->load('http://feeds.gawker.com/lifehacker/full');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$a = $node->getElementsByTagName('title')->item(0)->nodeValue;
$a = $node->getElementsByTagName('image')->item(0)->nodeValue;
}