Page is a not externally linkable
- Code, Content, and Presentation
-- RSS, ATOM, and Related Technologies
---- rss output problem while parsing with megpie


mochden - 9:13 pm on Nov 13, 2007 (gmt 0)


hi guys im trying to build dynamic rss feed from our data base, then use megpie to parse them. im not sure where is the problem on my code, im getting this error while parsing the feed :

Warning: MagpieRSS: Failed to parse RSS file. (xml declaration not at start of external entity at line 1, column 1) in /home/example/public_html/testserv/rssdemo/magpierss/rss_fetch.inc on line 238
Problem with: <snip>

any help will be really appreciated. here is the code to get the data out of mysql and get the clea xml.


<?php
include("dbinfo.inc.php");
$dbconnect = mysql_pconnect(localhost,$username,$password);
mysql_select_db($database, $dbconnect);
$query = "SELECT id, title, itemcomment, picturelink FROM jos_seyret_items WHERE featured='1' order by id desc limit 15";
$result = mysql_query($query, $dbconnect);
while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}
$now = date("D, d M Y H:i:s T");
$output = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>What's hot</title>
<link>http://www.example.com/RSS/whatshot.php</link>
<description>Latest Video on example.com</description>
<language>en-us</language>
<pubDate>$now</pubDate>
";
foreach ($return as $line)
{
$output .= "<item><title>".htmlentities($line['title'])."</title>
<link>http://www.example.com/index.php?option=com_seyret&Itemid=27&task=videodirectlink&id=".htmlentities($line['id'])."</link>
<description>".htmlentities(strip_tags($line['itemcomment']))."</description>
</item>";
}
$output .= "</channel></rss>";
header("Content-Type: application/rss+xml");
echo $output;
?>

[edited by: bill at 1:07 am (utc) on Nov. 14, 2007]
[edit reason] No links to examples or URLs in your code please [/edit]


Thread source:: http://www.webmasterworld.com/rss_atom/3504110.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com