trying to update an xml file from PHP....any help would be appreciated!
it is supposed to open the outdated rss.xml and update it with the latest 6 entries from the table....
must be something wrong with the opening of the file...getting the error:
Warning: fopen(rss.xml) [function.fopen]: failed to open stream: Permission denied in /home/mysiteinfo/public_html/mysiteinfo/rss/update_rss.php on line 31
can't open file
<?
///////// Connect to the DB ///////////////////////////////////////////
require_once('../mysql_connect.php');
///////// Getting the data from Mysql table for first list box ////////
$quer2=mysql_query("SELECT * FROM rss ORDER BY rss_id DESC LIMIT 0,6");
///////// End of query for first list box /////////////////////////////
$body="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<rss version=\"2.0\">
<channel>
<title>My Site Name</title>
<link>http://www.mysite.com</link>
<description>my site description</description>
<copyright>(c) 2007, mysite.com. All rights reserved.</copyright>
";
while($nt = mysql_fetch_array($quer2)) {
$body .="
<item>
<title>$nt[title]</title>
<link>$nt[link]</link>
<description>$nt[description]</description>
<pubDate>$nt[pubdate]</pubDate>
</item>";
}
$body .="
</channel>
</rss>";
echo $body;
$path="rss.xml";
$file_name=fopen($path,"w") or die("can't open file");
fwrite($file_name,$body);
fclose($file_name);
?>