The method you all had tell me i had tried but it still wont work, is that my script problem.........

here is my script, can someone check it out what is the problem?


<?php
function get_my_xml($filename,$folder)
{
if((!$file = fopen("http://p.moreover.com/cgi-local/page?index_$filename+xml", "r")) or (!$rf = fread($file, 21000)))
{
echo "<td><tr><font face="Arial, Helvetica, sans-serif" size="1">Error on loading this news, please click refresh.<BR><BR></font></tr></td>";
}
else
{
$grab = eregi("<moreovernews>(.*)</moreovernews>", $rf, $printing);
$pieces = explode("<article", $printing[0]);
for($x=1;$x<=3;$x++)
{
if(empty($pieces[$x]))
{
echo "<td><tr>Error on loading this news, please click refresh.<BR><BR></tr></td>";
continue;
}
else
{
ereg("<url>(.*)</url>",$pieces[$x],$url );
ereg("<headline_text>(.*)</headline_text>",$pieces[$x],$headline );
ereg("<source>(.*)</source>",$pieces[$x],$source );
ereg("<document_url>(.*)</document_url>",$pieces[$x],$docurl );

$temp_url[$x-1] = "<url>$url[1]</url>"."r";
$temp_headline[$x-1] = "<headline>$headline[1]</headline>"."r";
$temp_docurl[$x-1] = "<docurl>$docurl[1]</docurl>"."r";
$temp_source[$x-1] = "<source>$source[1]</source>"."r";
}
}

$str_open_moreover = "<moreovernews>"."r";
$str_close_moreover = "</moreovernews>"."r";
$str_open_article = "<article>"."r";
$str_close_article = "</article>"."r";
$fp = fopen("my_xml/$folder/$filename+xml.inc", "w");
$str_xml = "<?xml version="1.0" encoding="iso-8859-1"?>";
///usr/local/etc/httpd/vhosts/telenet.com.my/kmf/news_xml/
//<!DOCTYPE moreovernews SYSTEM "http://p.moreover.com/xml_dtds/moreovernews.dtd">
fputs($fp,$str_xml);
fputs($fp,$str_open_moreover);
for($x=0;$x<=2;$x++)
{
fputs($fp,$str_open_article);
fputs($fp,$temp_url[$x]);
fputs($fp,$temp_headline[$x]);
fputs($fp,$temp_docurl[$x]);
fputs($fp,$temp_source[$x]);
fputs($fp,$str_close_article);
}
fputs($fp,$str_close_moreover);
}
fclose($fp);
}//end function

//parsing financial news from moreover......
$folder ="finance_xml";
get_my_xml("accounting",$folder);
get_my_xml("banking",$folder);
get_my_xml("commodities",$folder);
get_my_xml("corporatefinance",$folder);
get_my_xml("derivatives",$folder);
get_my_xml("emergingmarkets",$folder);
get_my_xml("equity",$folder);
get_my_xml("fedwatch",$folder);
get_my_xml("financefeatures",$folder);
get_my_xml("forex",$folder);
get_my_xml("fundmanagement",$folder);
get_my_xml("IPO",$folder);
get_my_xml("insurance",$folder);
get_my_xml("mergersacquisitions",$folder);
get_my_xml("mortgage",$folder);
get_my_xml("onlinebanking",$folder);
get_my_xml("onlinebroker",$folder);
get_my_xml("securitiesindustry",$folder);
get_my_xml("stockexchanges",$folder);
get_my_xml("stockwatch",$folder);
get_my_xml("techstocks",$folder);
get_my_xml("topfinance",$folder);
get_my_xml("venturecapital",$folder);


//parsing technology news from moreover......
$folder ="tech_xml";
get_my_xml("commsequipment",$folder);
get_my_xml("computergames",$folder);
get_my_xml("computersecurity",$folder);
get_my_xml("computerservices",$folder);
get_my_xml("databaseindustry",$folder);
get_my_xml("developer",$folder);
get_my_xml("digitaltelevision",$folder);
get_my_xml("enterprisecomputing",$folder);
get_my_xml("imagingequipment",$folder);
get_my_xml("java",$folder);
get_my_xml("linux",$folder);
get_my_xml("motorola",$folder);
get_my_xml("os",$folder);
get_my_xml("pcindustry",$folder);
get_my_xml("pcsoftware",$folder);
get_my_xml("robotics",$folder);
get_my_xml("semiconductorindustry",$folder);
get_my_xml("techlatest",$folder);
get_my_xml("techfeatures",$folder);
get_my_xml("techpolicy",$folder);
get_my_xml("telecom",$folder);
get_my_xml("toptechnology",$folder);
get_my_xml("wap",$folder);
get_my_xml("windows",$folder);
get_my_xml("wireless",$folder);
get_my_xml("xml",$folder);


//parsing hot news from moreover......
$folder ="hot_xml";
get_my_xml("businessfeatures",$folder);
get_my_xml("economics",$folder);
get_my_xml("entrepreneur",$folder);
get_my_xml("environment",$folder);
get_my_xml("humanresources",$folder);
get_my_xml("journalism",$folder);
get_my_xml("knowledgemanagement",$folder);
get_my_xml("management",$folder);
get_my_xml("marketing",$folder);
get_my_xml("mediafeatures",$folder);
get_my_xml("medical",$folder);
get_my_xml("publichealth",$folder);
get_my_xml("science",$folder);
get_my_xml("spacescience",$folder);
get_my_xml("topbusiness",$folder);
get_my_xml("topmedia",$folder);
get_my_xml("topstories",$folder);
get_my_xml("trade",$folder);
get_my_xml("womensrights",$folder);


//parsing sport news from moreover......
$folder ="sport_xml";
get_my_xml("baseball",$folder);
get_my_xml("basketball",$folder);
get_my_xml("boxing",$folder);
get_my_xml("cricket",$folder);
get_my_xml("soccer",$folder);
get_my_xml("golf",$folder);
get_my_xml("horseracing",$folder);
get_my_xml("icehockey",$folder);
get_my_xml("motorsports",$folder);
get_my_xml("olympics",$folder);
get_my_xml("olmpicgames",$folder);
get_my_xml("rugby",$folder);
get_my_xml("tennis",$folder);
get_my_xml("topsports",$folder);
get_my_xml("yachting",$folder);
?>