Jump to content

[SOLVED] RSS Feed creator problem - not valid RSS feed?


vynsane

Recommended Posts

i've been working on a script that would generate an RSS feed, and that seems to work, it displays the feed in FireFox the way it should, but when i try to link to it as a live bookmark or aggregate it in thunderbird, it claims it to not be a valid feed. here's the feed:

 

http://www.wallcrawlersweb.com/news/feed/news.rss

 

and here's the script that generates it:

 

$fp = fopen ("news.rss", "w");
fwrite ($fp, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"); 
fwrite ($fp, "\t<rss version=\"2.0\">\n");
fwrite ($fp, "\t\t<channel>\n");
fwrite ($fp, "\t\t\t<title>WallCrawlersWeb.com - Spider-man News</title>\n");
fwrite ($fp, "\t\t\t<link>http://www.WallCrawlersWeb.com/news/</link>\n");
fwrite ($fp, "\t\t\t<description>News from all aspects of Spider-man collecting: Comics, Movies, Toys, Collectibles, Television, Video Games</description>\n");
fwrite ($fp, "\t\t\t<language>en-us</language>\n");
fwrite ($fp, "\t\t\t<docs>http://www.WallCrawlersWeb.com/news/feed/news.rss</docs>\n");
(database connection deleted)
    $newsQuery = "SELECT Members.username, NewsCat.catName, NewsItem.* FROM Members, NewsCat, NewsItem WHERE NewsItem.category = NewsCat.ID AND Members.id = NewsItem.Members_id ORDER BY NewsItem.id DESC";

  	$newsobject = mysql_query($newsQuery) or die(mysql_error());

	while ($row = mysql_fetch_array($newsobject)) {

    $newsCat = $row['catName'];
	$title = stripslashes($row['title']);
	$teaser = stripslashes($row['preview']);
	$ID = $row['id'];
	$username = $row['username'];
	fwrite ($fp, "\t\t\t<item>\n");
	fwrite ($fp, "\t\t\t\t<title>$newsCat: $title</title>\n");
	fwrite ($fp, "\t\t\t\t<description>$teaser</description>\n");
	fwrite ($fp, "\t\t\t\t<link>http://www.WallCrawlersWeb.com/news/article/$ID</link>\n");
	fwrite ($fp, "\t\t\t</item>\n");
}
fwrite ($fp, "\t\t</channel>\n");
fwrite ($fp, "\t</rss>\n");
fclose ($fp);

 

is there something wrong in my script? should i get rid of the tab and newline regexes?

 

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.