You are here:  » BBC News Headlines (RSS)


BBC News Headlines (RSS)

This example parses the BBC News RSS feed to display the latest news headlines, showing the headline (linked to the main article) and item description. Click here to view the live output from this script.

<?php
  
require("MagicParser.php");
  
  function 
myRecordHandler($record)
  {
    print 
"<h1>".$record["TITLE"]."</h1>"
    
    print 
"<p>".$record["DESCRIPTION"]."</p>";
    
    print 
"<a href='".$record["LINK"]."'>Read More</a>";
  }

  
$url "http://feeds.bbci.co.uk/news/rss.xml?edition=uk";
  
  
MagicParser_parse($url,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>