【发布时间】:2011-11-26 03:16:03
【问题描述】:
我正在尝试从以下 RSS 提要(以下仅部分提要)中提取 IMG SRC 值。
我目前正在使用 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??>;
...
}
但是 - 我如何从 RSS 提要下方获取 IMG SRC 值到 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>
【问题讨论】: