cb154 Posted November 10, 2010 Share Posted November 10, 2010 Hi, I have a small piece of code that creates an RSS feed using a mysql database. The issue is the page itself is blank however if I right click and view source I can see all the feed there. I convert the dat time field into a standard RSS date field. The web address is http://vinovote.com/news/feed.php My code is as follows <?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <rss version="2.0"> <channel> <title>Vinovote.com</title> <description>The Latest News And Views From Around The Web</description> <link>http://www.vinovote.com/</link> <copyright>Your copyright information</copyright> <?php require_once('../Connections/connection.php'); mysql_select_db($database_vinovotedb, $vinovotedb); $doGet = mysql_query("SELECT feed_content.feed_content_id, feed_content.feed_id, feed_content.url, feed_content.title, feed_content.content, feed_content.item_time, Date_FORMAT(feed_content.item_time,'%a, %d %b %Y %T') AS pubDate FROM feed_content order by item_time desc LIMIT 50 ", $vinovotedb) or die(mysql_error()); while($result = mysql_fetch_array($doGet)){ ?> <item> <title> <?php echo $result['title']; ?></title> <description> <?php echo $result['content'];?></description> <link><?php echo $result['url'];?></link> <pubDate> <?php echo $result['pubDate']; ?></pubDate> </item> <?php } ?> </channel> </rss> Link to comment https://forums.phpfreaks.com/topic/218294-php-creating-an-rss-feed/ Share on other sites More sharing options...
requinix Posted November 10, 2010 Share Posted November 10, 2010 Doesn't look blank to me. You need to change the Content-Type though: it's currently text/html and that's not right. At the very top of the script, before you output anything, header("Content-Type: application/xml"); Link to comment https://forums.phpfreaks.com/topic/218294-php-creating-an-rss-feed/#findComment-1132671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.