2

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 ?

David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
Kevin Campion
  • 2,223
  • 2
  • 23
  • 29

1 Answers1

3

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 Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132