Adding an RSS Feed with PHP


I have a marketing web site at www.marketingeda.com and when I updated from PHP 4 to 5 my RSS feed reader stopped working. So I browsed for a simple replacement that worked well with PHP 5 and found something called MagpieRSS at SourceForge that worked wonderful.

Here’s the simple PHP code that I needed to insert on my page where I wanted the RSS feed to appear:

require(‘classes/rss/rss_fetch.inc’);
$rss = fetch_rss(‘http://www.chipdesignmag.com/payne/feed/’);
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[link];
$description = $item[description];
echo “<a href=$url>$title</a></li><br>$description<br>”;
}

1
<br />

Here’s what this feed outputs on my page:

Leave a Reply