Jump to content

RSS - XML parse errors etc


surfsup

Recommended Posts

First time attempting to do this ie create a dynamic rss feed. Hoping someone can have a look at the below. I just can't seem to get it to work. Specifically i get a parse error on line 35 when in FF. When i check url in a reader it shows no items

 

<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
// Set RSS version.
echo "
<rss version=\"2.0\"> ";
// Start the XML.
echo "
<channel>
<title>Caravanorcamper.com News</title>
<description>Caravan or Camper is a drectory and networking site of rental firms and indivduals across the globe.</description>
<link>http://www.caravanorcamper.com/</link>";
// Create a connection to your database.
require("includes/connect.php");
// Query database and select the last 10 entries.
$data = mysql_query("SELECT * FROM web_rss_items ORDER BY id DESC LIMIT 10");
while($row = mysql_fetch_array($data))
{
// Convert database images data into actual image link.
$row[description] = str_replace("images/", "http://www.caravanorcamper.com.au/images/", $row[description]);
// Continue with the 10 items to be included in the <item> section of the XML.
echo "
<item>
<link>http://www.caravanorcamper.com/article.php?id=".$row[id]."</link>
<guid isPermaLink=\"true\">http://www.caravanorcamper.com/article.php?id=".$row[id]."</guid>
<title>".$row[Title]."</title>
<description>".$row[description]."</description>
</item>";
}
// substr can limit the number of characters. First number is starting point while the second number is number of

// otherwise just use $row[description].
// <guid> is an optional sub-element of <item> but recommended if you don’t want to receive a


echo "
</channel>
</rss>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.