php get rss tag using DOM
php get rss tag using DOM
am 08.02.2009 18:14:47 von Morris
--001636c5a64e1ddc3704626b6439
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hi,
I am trying to write a programme to read a rss xml file.
....
....
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
}
--001636c5a64e1ddc3704626b6439--
Re: php get rss tag using DOM
am 08.02.2009 19:22:54 von Nathan Rixham
Morris wrote:
> Hi,
>
> I am trying to write a programme to read a rss xml file.
>
> ...
>
> ...
>
> 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
Re: php get rss tag using DOM
am 08.02.2009 23:58:57 von Morris
--001636c5ac74f1c5b5046270327e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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
> Morris wrote:
>
>> Hi,
>>
>> I am trying to write a programme to read a rss xml file.
>>
>> ...
>>
>> ...
>>
>> 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 :)
>
--001636c5ac74f1c5b5046270327e--
Re: php get rss tag using DOM
am 09.02.2009 12:08:58 von Rob Richards
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
>
>> Morris wrote:
>>
>>> Hi,
>>>
>>> I am trying to write a programme to read a rss xml file.
>>>
>>> ...
>>>
>>> ...
>>>
>>> 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
Re: php get rss tag using DOM
am 04.07.2009 03:41:29 von Rodgerr
Morris-25 wrote:
>
> Hi,
>
> I am trying to write a programme to read a rss xml file.
>
> ...
>
> ...
>
> 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
>
> }
>
>
Hi. Our site http://rssphp.blogspot.net http://rssphp.blogspot.net is
working on providing possible solutions to the problem with different
parsing methods in PHP. It's worth to have a look at the options.
--
View this message in context: http://www.nabble.com/php-get-rss-tag-using-DOM-tp21901033p2 4330531.html
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php get rss tag using DOM
am 04.07.2009 07:14:55 von Michael Peters
Rodgerr wrote:
>
>
> Morris-25 wrote:
>> Hi,
>>
>> I am trying to write a programme to read a rss xml file.
>>
>> ...
>>
>> ...
>>
>> 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++) {
>>
$node = $r->item($i);
if ($node->hasAttribute('url') {
$url[] = $node->>getAttribute('url');
}
>>
>> }
That should give you an array called $url of all the url attributes in
the nodes.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php get rss tag using DOM
am 04.07.2009 08:23:30 von Michael Peters
Michael A. Peters wrote:
> Rodgerr wrote:
>>
>>
>> Morris-25 wrote:
>>> Hi,
>>>
>>> I am trying to write a programme to read a rss xml file.
>>>
>>> ...
>>>
>>> ...
>>>
>>> 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++) {
>>>
>
> $node = $r->item($i);
> if ($node->hasAttribute('url') {
> $url[] = $node->>getAttribute('url');
> }
>
>>>
>>> }
>
> That should give you an array called $url of all the url attributes in
> the nodes.
>
$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 ...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php get rss tag using DOM
am 20.08.2009 14:06:53 von Rodgerr
Getting RSS Feeds is going really good right now, what amazing technology :)
http://www.msnnick.net Nickname Msn
Morris-25 wrote:
>
> Hi,
>
> I am trying to write a programme to read a rss xml file.
>
> ...
>
> ...
>
> 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
>
> }
>
>
--
View this message in context: http://www.nabble.com/php-get-rss-tag-using-DOM-tp21901033p2 5060811.html
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php