One of the most common things we do in today’s Web2.0 programming are RSS feeds. Now there’s a bunch of ways you can add RSS feeds to your website but let me tell you the BEST way using PHP.
1) Download and unzip Magpie RSS in your website root directory somewhere.
2) Anywhere in your PHP code, add the following line, while making sure the full directory path is specified. (I usually like to put it in directory such as “magpie”)
require('rss_fetch.inc'); $myurl="http://zedomax.com/blog/feed"; $rss = fetch_rss($myurl); $ct=0; foreach ($rss->items as $item ) { $title = $item[title]; $desc = $item[description]; $url = $item[link]; echo '<li><a href="'.$url.'" title="'.$desc.'">'.$title.'</a></li>'; if($ct==9) break; $ct++; }
This will output the latest 10 RSS items. You can of course, change values and also do much more with more configuration. Refer to Magpie RSS Documents here.
There, you can probably do this in 5 minutes. I find it better to use this over any other WordPress RSS plugin because it’s simple and it works. I used to use a plugin that kept dying on me or was simply too slow.
Using straight Magpie RSS is really fast and great for making some custom RSS sites.
Of course, couple it with PHP caching and you already got a website that can handle a LOT of traffic. 🙂
6 Responses to PHP DIY – How to Add RSS Feeds to Any Website/Blog using Magpie RSS Parser!
Leave a Reply

I must be dumb, I’ve always wanted to know how to do this and you and do it in 5mins!
Hi. I read a few of your other posts and wanted to know if you would be interested in exchanging blogroll links?
Hello, I can’t understand how to add your blog in my rss reader.plz tell me thank you.johnhoma
You can subscribe via e-mail too, or use Google RSS reader.
Oi! Just what I need to know, Magpie always confused me.
Oi! Just what I need to know, Magpie always confused me.