I am VERY new to PHP (hence I am asking the experts out there) and I have been using PHP code in a webpage to download certain RSS feeds within a table, but it sometimes pulls up more informations than others, and I cant understand why. I was told that I could need a cache file...but I have no idea how to set one up...or if I even need one.
I included the full code (below) and if you refresh the page several times, you should notice that you will randomly pull more/less information. Why?
thanks in advance for all your help!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
//this is your newsfeed , you can use any rss file here
$xmlfile = fopen("
http://support.microsoft.com/common/rss.aspx?rssid=2520&ln=en-us&msid=988e136407fdea4088d99b2f0bb37691", "r");
//if file doesnt exist , quit
if(!$xmlfile)die("cannot open the xml file");
//read in 40000 bytes of the $xmlfile
$readfile = fread($xmlfile ,40000);
//search for the
$searchfile = eregi("<item>(.*)</item>",
$readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
//build our table
echo "<table border='0'>";
//display our heading
echo "<th colspan='2'>latest news</th>";
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>"
,$filechun
ks[$i], $title);
ereg("<link>(.*)</link>",$
filechunks
[$i], $links);
echo "<tr><td>";
//display all the titles
echo $title[1];
echo "</td><td>";
//display all the links
echo "<a href ='$links[1]'\>$links[1]</a
>";
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Start Free Trial