Re: php get rss tag using DOM
| From: | Michael A. Peters | Date: | Sat, 04 Jul 2009 06:23:30 +0000 |
| Subject: | Re: php get rss tag using DOM | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294875@lists.php.net to get a copy of this message | ||
Michael A. Peters wrote:
Rodgerr wrote:$url[] = $node->>getAttribute('url'); should be $url[] = $node->getAttribute('url'); and don't forget to validate it before spitting it back out on a page somewhere ...Morris-25 wrote:$node = $r->item($i); if ($node->hasAttribute('url') { $url[] = $node->>getAttribute('url'); }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 codessimilar: $doc = new DOMDocument; $doc->load($myFlickrRss); $r = $doc->getElementsByTagName('media:content'); for($i=0;$i<=$r->length;$i++) {That should give you an array called $url of all the url attributes in the nodes.}