[PHP] Re: php get rss tag using DOM
Morris wrote: I know rss_php, but it doesn't fit my solution. Is anyone able to help me with my question? thx 2009/2/8 Nathan Rixham nrix...@gmail.com Morris wrote: Hi, I am trying to write a programme to read a rss xml file. ... media:content url=*exampe.jpg* ... ... scan anyone tell me how to get the url attribute? I wrote some codes similar: $doc = new DOMDocument; $doc-load($myFlickrRss); $r = $doc-getElementsByTagName('media:content'); for($i=0;$i=$r-length;$i++) { // help here } use http://rssphp.net/ you can view the source online and it's all done using DOMDocuments :) First off, you should be using getElementsByTagNameNS since you are working with a namespaced document. I am assuming its a Yahoo Media RSS feed, so you would get the elements via: $r = $doc-getElementsByTagNameNS(http://search.yahoo.com/mrss/;, content); Then to output the url attribute value: foreach ($r AS $elem) { echo $elem-getAttribute(url) . \n; } Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php get rss tag using DOM
Morris wrote: Hi, I am trying to write a programme to read a rss xml file. ... media:content url=*exampe.jpg* ... ... scan anyone tell me how to get the url attribute? I wrote some codes similar: $doc = new DOMDocument; $doc-load($myFlickrRss); $r = $doc-getElementsByTagName('media:content'); for($i=0;$i=$r-length;$i++) { // help here } use http://rssphp.net/ you can view the source online and it's all done using DOMDocuments :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php get rss tag using DOM
I know rss_php, but it doesn't fit my solution. Is anyone able to help me with my question? thx 2009/2/8 Nathan Rixham nrix...@gmail.com Morris wrote: Hi, I am trying to write a programme to read a rss xml file. ... media:content url=*exampe.jpg* ... ... scan anyone tell me how to get the url attribute? I wrote some codes similar: $doc = new DOMDocument; $doc-load($myFlickrRss); $r = $doc-getElementsByTagName('media:content'); for($i=0;$i=$r-length;$i++) { // help here } use http://rssphp.net/ you can view the source online and it's all done using DOMDocuments :)