Here is some simple PHP code to display RSS feed data from external sites on your web page.

Using powerful features of the PHP scripting language, this is a surprisingly simple task to achieve. But make sure you have permission to use any feeds in this way.

My example uses the BBC News feed which is free to use as long as proper attribution is included in your page e.g. “News from the BBC”.

<?php
$rss = fetch_rss("http://newsrss.bbc.co.uk/rss/newsplayer_world_edition/uk/rss.xml");

echo "<h2>", $rss->channel[‘title’], "</h2>";
foreach ($rss->items as $item ) {
        $title = $item[title];
        $description = $item[description];
        $url = $item[link];
}
?>
 


Filed under: Tools by Andy