0

我正在尝试使用 PHP 显示来自 RSS 提要的结果。我已经成功使用了 magpie [magpierss.sourceforge.net] 和 rss_php [rssphp.net]

但是,两个解析器在获取属性值时都遇到了问题,特别是 media:thumbnail

<media:content url="http://cache.wdcdn.net/cdn/asset/view/client/sfi/package/library/id/692313/format/o/h/5c5b86ff5dc804b2d314b3a9718bdef0/JelloAdultContentDirsCut.m4v?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0b41a1f35116ad845809e136636fd6663e34fb341ed348bcd006.m4v" fileSize="5936750" type="video/mp4" duration="32" height="360" width="640"/>

<media:thumbnail url="http://cache.wdcdn.net/cdn/asset/view/client/sfi/package/library/id/692313/format/t/size/lg/h/c374cb3c669fdb346ad82adb16b41b4a/library_692313_lg.jpg?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0b41a1f35116ad845809e136636fd6663e34fb341ed348bcd006.jpg" height="360" width="634"/>

<media:thumbnail url="http://cache.wdcdn.net/cdn/asset/view/client/sfi/package/library/id/692313/format/t/size/sm/h/c374cb3c669fdb346ad82adb16b41b4a/library_692313_sm.jpg?7a6013aef28682d61703dff120d21b12266b54a2a637283d7d4f0a0b41a1f35116ad845809e136636fd6663e34fb341ed348bcd006.jpg" height="102" width="180"/>

<media:credit role="client" scheme="urn:feeds-wiredrive-com:credits"><![CDATA[Jell-O]]></media:credit>

<media:credit role="director" scheme="urn:feeds-wiredrive-com:credits"><![CDATA[Jerry Simpson]]></media:credit>

<media:credit role="agency" scheme="urn:feeds-wiredrive-com:credits"><![CDATA[CPB]]></media:credit>

<media:keywords><![CDATA[Chocolate, dessert, fruit, Jell-O, pudding]]></media:keywords></item>

任何提示或帮助?我难住了。

4

2 回答 2

0

我的解决方案是使用 simplepie。simplepie.org非常好的解析器,并为此内置了类。get_thumbnail()和许多其他有用的类。推荐的

于 2012-04-26T19:56:36.773 回答
0

也许您可以尝试使用这些预建类之一吗?http://php.net/manual/en/refs.xml.php 例如,试一试 simplexml。

于 2012-04-24T22:07:29.617 回答