Welcome to WebmasterWorld Guest from 54.159.246.164

Forum Moderators: bill & werty

Message Too Old, No Replies

rss output problem while parsing with megpie

parsing rss feed mysql php

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

5+ Year Member



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]

3:43 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Just curious as to whether you managed to solve your problem? If so, was it an issue with MagpieRSS, or your RSS feed itself?
11:06 pm on Nov 27, 2007 (gmt 0)

5+ Year Member



I coudnt get it to work with megpie for some reason, so i changed the pvp script to get the my feed clean and then validated it. works pretty good now.