PHP: RSS and Atom Feed Reader
RSS and Atom feeds are one of the new 'big things' of the Internet of the 21st century. The idea is that you set up a data-file containing a list of news items, articles, or basically anything, and people around the world "subscribe" using one of the multitude of 'news aggregators'.
The PHP XML library makes it relatively simple to parse a single feed, but more complicated when you have to deal with all the different formats in a single script.
RSS/Atom Feed Reader Demonstration
Use the form below to select a feed and run it through our parser. Note that most feeds are free to access for personal use, but if you want to use them for a commercial site or application you might have to pay the provider.
The source code for extracting information from RSS (or Atom) Feeds can be downloaded by following links at the bottom of the page. It will download a feed and convert it to HTML. The advantage of using PHP over JavaScript is that the feed content can now be cached and indexed by search engines.
This is a work in progress so any feedback is welcome. The scripts for reading RSS and Atom feeds are currently independent but could be combined relatively easily. You will notice that the options above contain both RSS- and Atom-formatted feeds.
References
- RSS 2.0 Specification
- All About RSS
- Character encodings and the beauty of UTF-8
- RSS Tutorial for Content Publishers and Webmasters
Related Articles - Feed Readers
- PHP RSS Feed Reader Code Example
- PHP Combined RSS and Atom Feed Reader
- PHP Feed Reader with Ajax Updating
- PHP RSS Feed Reader: Source Code
- PHP Displaying and updating RSS Content using Ajax
- PHP YouTube API Feed Reader: Source Code
- PHP RSS and Atom Feed Reader
- PHP Atom Feed Reader: Source Code
Anthony Florkoski 29 August, 2018
Is this feed-reader script still working?
How exactly do I put it into a working web page for my personal use?
Yes, it's working. Some of the feed URLs keep changing, but otherwise no problem. You can find examples under "Related Articles" above.
Dan 18 January, 2011
I'm trying to use this to parse the feed generated by a Yahoo! Pipe I've created. The RSS feed (a 2.0 feed) has only one CHANNEL which includes a bunch of crap from Yahoo! that I don't want published.
How can I set it up to start outputting from the ITEM tags rather than CHANNEL?
You can edit the display_channel function to stop the TITLE, DESCRIPTION, PUBDATE and other CHANNEL information appearing in the HTML output.
Pascal 19 March, 2008
I would like to know if it's possible to extract on youtube rss feed.
You should be able to display your RSS feed from YouTube using our RSS Feed Reader. It worked fine for me in testing with the URL you provided.
Amit Sood 8 February, 2008
The examples you've given are great and do EXACTLY what i'm looking for, only problem is i'm a complete noob at all of this and everytime i try to make my own convertor, i only get a page with the code on it!
It sounds like your script isn't being parsed with PHP. Try first to get the simple phpinfo function to run before trying other PHP code.