Hey dudes,
I have a problem with making rss feed with php.
i generate the XML file and when i try to open it in the browser i get the following error:
XML Parsing Error: not well-formed
Location: http://localhost/sms-feed.php
Line Number 1, Column 2:<?xml version=“1.0” encoding=“UTF-8”?>
-^
and here is the PHP code that generates the XML doc:
require_once "db/MessageQueries.php";
$mq = new MessageQueries();
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
// Set RSS version.
echo "
<rss version=\"2.0\"> ";
$now = date("D, d M Y H:i:s");
echo "
<channel>
<title>SMS Feed</title>
<description>Customers feedback</description>
<pubDate>$now</pubDate>
<link>http://www.raahe247.net</link>
";
$rss = $mq->getMessages();
for($i =0; $i<count($rss);$i++) {
$sms = $rss[$i][message];
$time = $rss[$i][ts_sended];
echo "<item>
<title></title>
<description><![CDATA[$sms]]></description>
<pubDate>$time</pubDate>
<link></link>
</item>";
}
echo "</channel>
</rss>";
When i take the source from browser , it seems to be ok. I guess i have messed up with encodes somehow, coz if i chance all my php code files to ANSI the rss feed works fine. I rather use utf-8 because of special characters. I wish u have some ideas what might be wrong. I have tried all kind of stuff with no success.
Aldor