RE: [PHP] XML and PHP - dynamic hell
| From: | Matthew Loff | Date: | Sat, 01 Dec 2001 15:03:17 +0000 |
| Subject: | RE: [PHP] XML and PHP - dynamic hell | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76317@lists.php.net to get a copy of this message | ||
Did you try adding:
header("Content-Type: text/xml");
To the top?
-----Original Message-----
From: Chris [mailto:chrisderson@ameritech.net]
Sent: Saturday, December 01, 2001 12:34 AM
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net