homepage Welcome to WebmasterWorld Guest from 54.227.25.58
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
rss output problem while parsing with megpie
parsing rss feed mysql php
mochden




msg:3504112
 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]

 

penders




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

Just curious as to whether you managed to solve your problem? If so, was it an issue with MagpieRSS, or your RSS feed itself?

mochden




msg:3514808
 11:06 pm on Nov 27, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved