解析元數據我想extact的IMG SRC值了以下RSS源(僅低於偏饋)的。在RSS提要PHP
我目前使用的XML解析器來獲得其餘項目 - 這工作正常(例如):
foreach($xml['RSS']['CHANNEL']['ITEM'] as $item)
{
...
$title = $item['TITLE'];
$description = $item['DESCRIPTION'];
$link = $item['LINK'];
$desc_imgsrc = <how do i get this for below RSS feed??>;
...
}
但是 - 我如何得到的IMG SRC值從以下RSS饋送到一個PHP變量?具體而言,我試圖將「http://thumbnails.---.com/VCPS/sm.jpg」字符串轉換爲上面的$ desc_imgsrc變量?我如何適應上面的代碼來做到這一點?謝謝。
<item>
<title>Electric Cars - all about them</title>
<metadata:title xmlns:metadata="http://search.--.com/rss/2.0/Metadata">This is the title metadata</metadata:title>
<description>This is the description</description>
<metadata:description xmlns:metadata="http://search.---.com/rss/2.0/>
<![CDATA[<div class="rss_image" style="float:left;padding-right:10px;"><img border="0" vspace="0" hspace="0" width="10" src="http://thumbnails.---.com/VCPS/sm.jpg"></div><div class="rss_abstract" style="font:Arial 12px;width:100%;float:left;clear:both">This is the description</div>]]></metadata:description>
<pubDate>Fri, 25 Nov 2011 07:00 GMT</pubDate>
謝謝。這將工作$ desc_imgsrc = $ item ['METADATA:DESCRIPTION']; – ChicagoDude