Checking out World’s Simplest RSS Reader

Opinion
Nov 29, 20042 mins

* A feed reader for RSS feeds

I just stumbled across the simplest RSS news feed reader yet. Billed as the World’s Simplest RSS Reader in PHP (weighing in at a mere 2.5K byte), it is definitely simple and very effective. Written by Kailash Nadh, this script was intended as a feed reader for RSS feeds generated by his lightweight blog system, boastMachine.

I had planned to write about boastMachine but I will have to defer that article until I sort out a bug I think I found in the latest version.

The RSS Reader relies on the PHP function xml_parser_create() and Nadh’s “Magic Loop” which moves the XML tags and tag contents into an array for easy manipulation. This is actually a wonderful example of handling XML data and can be easily adapted for all kinds of Web applications.

I couldn’t leave well enough alone so I modified the code so that I could use it for my own presentation purposes. I relied on PHP’s simple method for accessing values passed by an HTTP GET request. This simply requires you to use the same name in your PHP script as you use in the get request:

https://www.gibbs.com/examples/rss-reader.php?rssfeed=https://www.nwfusion.com/rss/howto.xml

In this example, (which actually works) you can see that the GET variable rssfeed (pointed to the Network World “how to” feed) is used in the script: $data=@fread(fopen(“$rssfeed”,”r”),10000) or die(“$rssfeed is not available.”);

In common with the minimalist approach of the original script, I designed the output of my version to be equally simple. Instead of using the original’s layout I used the feed item description in the name field of the item’s link so that mousing over the link reveals the text. This allowed me to incorporate the feed listing in a “data rich” page without adding even more visual complexity than I had to. I will use the script in iframes so that I can precisely allocate my screen space and I omitted any formatting in the output so that the script output format will be controlled by the output document.

Check out the page on my Web site that demonstrates this script’s uses.