[Magpierss-general] how to get the namespaces with magpie
Status: Beta
Brought to you by:
kellan
From: mustang <mus...@ya...> - 2012-07-04 09:23:24
|
Hi, I am struggling getting the data from the namespaces from the xml feed below. Here is my php code: ------------------------------------------------------------------------------------------------------------------------- require_once('magpie/rss_fetch.inc'); $url = 'http://www.alfa.com.com/rss?cat=24&lang=fr-FR&tsize=1&format=xml'; $rss = fetch_rss( $url ); foreach ($rss->items as $item) { $title = $item['title']; $category = $item['category']; $url = $item['player']; } ------------------------------------------------------------------------------------------------------------------------- Can someone tell me how - to get the data from <media:category> - to get the value of the url, width, heigh variables from the <media:player > tag - to get the data from <media:description> I have been looking for days for this and can't find figure how to get the data from these namespaces using magpie. Here the xml feed ------------------------------------------------------------------------------------------------------------------------- <entry> <title><aaaaaa></title> <link href="http://www.bbb.html" rel="alternate" /> <link href="http://www.ccc.swf" rel="enclosure" type="application/x-shockwave-flash" /> <id></id> <published>Mon, 02 Jul 2012 15:14:20 +0200</published> <updated>Mon, 02 Jul 2012 15:14:20 +0200</updated> <media:category>DDDD</media:category> <media:player url="http://www.ccc.swf" width="700" height="525" /> <player> <url>http://www.ccc.swf</url> <width>700</width> <height>525</height> </player> <media:thumbnail url="http://www.eeee.jpg" width="100" height="75" /> <thumbnail> <url>http://www.eeee.jpg</url> <width>100</width> <height>75</height> </thumbnail> <media:thumbnail url="http://www.eeee.jpg" width="120" height="90" /> <thumbnail> <url>http://www.eeee.jpg</url> <width>120</width> <height>90</height> </thumbnail> <media:thumbnail url="http://www.eeee.jpg" width="200" height="120" /> <thumbnail> <url>http://www.eeee.jpg</url> <width>200</width> <height>120</height> </thumbnail> <media:description><![CDATA[iiiiiiiiiiii !]]></media:description> <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml"> <b>Title: </b>aaaaa<br /> <b>Description: </b>kkkkkkk<br /> <b>Image: </b><img src="http://www.eeee.jpg" width="120" height="90" /><br /> <b>Categories: </b><br /> - DDDD<br /> <b>Embed:</b> <object width="700" height="525"><param name="movie" value="http://www.ccc.swf"></param><embed src="http://www.ccc.swf" type="application/x-shockwave-flash" width="700" height="525"></embed></object><br /> </div> </summary> </entry> ------------------------------------------------------------------------------------------------------------------------- I looked up the parse.inc file and saw that it should interprete the namespaces. But I can't figure out how to use the $ns and $el. Cheers, B. |