我有如下生成一個XML一個RSS提要URL:RSS XML解析的問題(如何從RSS提要媒體內容的價值?)
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:flow="http://www.flownetworks.com/schemas/media/0.1.0"><channel>
<title>flow-Media Catalog</title>
<link>http://catalog.flownetworks.com/catalogs/1/videos.mrss</link>
<description>Video Catalog</description>
<image>
<url>http://images.flow-media.com/flow_media_current.png</url>
<title>Get to know flow-Media</title>
<link>http://www.flow-media.com</link>
</image>
<generator>flow-Media</generator>
<item>
<title>..</title>
<link>..</link>
<description>..</description>
<pubDate>Wed, 01 May 2013 07:01:08 GMT</pubDate>
<guid isPermaLink="false">9809880</guid>
<flow:short_description/>
<flow:video_product_id>52985890</flow:video_product_id>
<flow:availability end="" start="2013-05-01T06:44:41Z"/>
<flow:show/>
<media:group>
<media:category>US</media:category>
<media:thumbnail url="http://images.flow-media.com/ap/2013/05/01/09d462107646ab09def454a1a923a423edd6d2d9_preview.jpg" height="360" width="640"/>
<media:thumbnail url="http://images.flow-media.com/ap/2013/05/01/09d462107646ab09def454a1a923a423edd6d2d9_thumbnail.jpg" height="90" width="160"/>
<media:content duration="101" medium="video" isDefault="true" url="http://player.flownetworks.com/swf/cube.swf?a=V5299690&m=9&w=420&h=375" type="application/x-shockwave-flash" expression="full" height="375" lang="en-us" width="420">
</media:content>
</media:group>
</item>
</channel>
我想保存的圖像和在database.Here類別值是我的PHP代碼:
$apiURL="http://catalog.flownetworks.com/catalogs/01/videos/search.mrss?api_key=%206784cb3bed8f80c55054ac0de996f8e9f0bf8763";
$videoId="&video_product_id=".$videoID."";
$combinevURL=$apiURL.$videoId;
$mediafile = simplexml_load_file($combinevURL);
問題:問題是「使用simplexml_load_file」不產生xml.I的類別名稱和媒體縮略圖值要從此xml.Please獲得價值幫幫我。
檢出http://stackoverflow.com/questions/1575788/php-library-for-parsing-xml-with-a-colons-in-tag-names用標記名稱中的冒號解析XML – Waygood 2013-05-01 12:31:04
@Waygood $ mediafile-> children('flow',true) - > media-> category;但它不返回任何東西 – CodePlayer 2013-05-01 12:42:35
可能:$ mediafile-> item-> children('media',true) - > group-> category – Waygood 2013-05-01 12:45:18