views:

98

answers:

1

I use Zend Framework to read an RSS feed is as simple as instantiating a Zend_Feed_Rss object with the URL of the feed :

$feed = new Zend_Feed_Rss('http://rss.exemple.com/feed');
echo $feed->title();

This method doesn't exists

echo $feed->version();

How I can get the version of Rss, like 2.0 or 0.92 ?

+2  A: 

It's certainly not obvious!

$feed = new Zend_Feed_Rss('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/uk/rss.xml');

$dom = $feed->getDOM();

$version = $dom->ownerDocument->documentElement->getAttribute('version');

This example works for RSS 2.0

You may need other checks for atom etc, but you can see how to access the root node now.

David Caunt
Perfect ! thanks
Kevin Campion