Okay, I've written some PHP that should generate an RSS feed for me, but it doesn't seem to even create the file. Please help!
[PHP]<?php
$dbhost = "*****";
$dbuser = "*****";
$dbpass = "*****";
$db = "sitemembers";
$connect = mysql_connect($dbhost,$dbuser,$dbpass)
or die(mysql_error());
$selectdb = mysql_select_db($db,$connect)
or die(mysql_error());
$query = "SELECT id,title,author FROM poetry";
$result = mysql_query($query)
or die(mysql_error());
$xmlname = "poetryrss.xml";
$xmlcreate = fopen($xmlname,'w')
or die("Cannot generate RSS feed.");
$xmldata = "
<xml version=\"1.0\" >
<rss version=\"2.0\">
<channel>
<title>The Essence of Nature: Poetry Feed</title>
<description>Great poetry delivered straight to you!</description>
<link>***naturesmagazine.com</link>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
$xmldata =. "
<item>
<title>$title</title>
<description>By $author</description>
<link>***naturesmagazine.com/membership/displayPoem.php?id={$id}</link>
</item>";
}
$xmldata =. "
</channel>
</rss>";
$xmlwrite = fwrite($xmlcreate,$xmldata)
or die("Cannot generate RSS feed.");
$xmldone = fclose($xmlcreate);
?>
[/PHP]
My ongoing projects...
www.naturesmagazine.com
www.energyreform.org *new domain*
www.photographyavenue.com
----
You may also remember me as imnewtophp...
Comments
feed://naturesmagazine.com/membership/poetryrss.xml
www.naturesmagazine.com
www.energyreform.org *new domain*
www.photographyavenue.com
----
You may also remember me as imnewtophp...
and if you use http://
just a heads up, its not valid xml
and don't you have to throw in a header("content-type: something"); somewhere?
the feed:// protocol is associated with an external program, so yes, it would essentially be http:// ... Maybe the feed:// protocol you're using for your external rss program doesnt work in Safari?
Also, instead of using header(); just place <?xml version="1.0" encoding="UTF-8"?> at the top of your RSS and it should get recognized as valid xml..
thats exactly what i meant...:p
It doesnt even open in Outlook for me, though, seeing as I refuse to install it.