解析元数据我想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