BBC sports news
Display BBC sports news on your site .
<?php
$xmlfile = fopen("http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml", "r");
if(!$xmlfile)
die("cannot open the site");
$readfile = fread($xmlfile ,40000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$chunks = explode("<item>", $arrayreg[0]);
$count = count($chunks);
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>",$chunks[$i], $title);
ereg("<link>(.*)</link>",$chunks[$i], $links);
echo "<li>";
echo "<a href ='$links[1]'\>$title[1]</a>";
echo "</li>";
}
?>
Example :
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/beginne/public_html/bbcnews.php on line 194
Warning: fopen(http://www.newsisfree.com/HPE/xml/feeds/87/3287.xml) [function.fopen]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/bbcnews.php on line 194
cannot open the site
|