Did you try adding:

header("Content-Type: text/xml");

To the top?


-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, December 01, 2001 12:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP] XML and PHP - dynamic hell


I'm having one page output XML for other sites to parse. Unfortunately
if I
give an RSS parser the site (the php file) it errors out. But if I put
the
output in a XML file, and give that to the RSS parser everything works
perfectly. Does anyone know why it can't read it straight from the php
file?
PHP Builder has it working, I have no idea why mine doesn't. Thanks

Source:

<?
require "division/settings.inc";
require RootPath . "admin/Admin.php";  //these just define mysql logins
and
such
echo "<" . "?xml version=\"1.0\"?" . ">\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS
0.91//EN\"
\"http://my.netscape.com/publish/formats/rss-0.91.dtd\";>\n";
echo "<rss version=\"0.91\">\n";
echo "<channel>\n";
  $query = mysql_query("Select * from " . PREFIX . "news order by Date
Desc
Limit 40");
  while($results = mysql_fetch_array($query))
  {
   echo "<item>\n";
   echo "<title>" . stripslashes($results["Subject"]) . "</title>\n";
   echo "<link>http://dod.stronger.org/</link>\n";
   echo "<author>$results[Name]</author>\n";
   echo "<description>" .
substr(htmlspecialchars(stripslashes($results["News"])),0,150) .
"...</description>\n";
   echo "</item>\n";
 }
?>
  </channel>
</rss>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to