Connecting Tech Pros Worldwide Forums | Help | Site Map

Magpie RSS Rejects PHP generated RSS Feed

Steve
Guest
 
Posts: n/a
#1: Apr 11 '07
Can any see why Magpie RSS won't accept this RSS Feed (that is valid
according to the Feed Validator website).

http://www.westyorksprobation.org.uk...p?type=Library

This is the code that generates it. A SQL query is run first into
$result and then:

if (mysql_num_rows($result)>0)
{
header("Content-Type: application/xml; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\r\n";
echo " <rss version=\"2.0\">\r\n";
echo "\r\n";
echo " <channel>\r\n";
echo " <title>" . htmlspecialchars($title) . "</title>\r\n";
echo " <link>".htmlspecialchars("http://
www.westyorksprobation.org.uk/")."</link>\r\n";
echo " <description>RSS Feed for the " . htmlspecialchars($title) .
"</description>\r\n";
echo " <language>en-gb</language>\r\n";
echo " <lastBuildDate>" . date("D, d M Y H:i:s O",time()) . "</
lastBuildDate>\r\n";
echo " <ttl>60</ttl>\r\n";
echo " <copyright>Copyright " . date("Y",time()) . " West Yorkshire
Probation Board</copyright>\r\n";

while($resultsrow=mysql_fetch_row($result))
{
echo " <item>\r\n";
echo " <title>" . htmlspecialchars($resultsrow[0]) . "</title>\r
\n";
echo " <description>" .
htmlspecialchars(strip_tags(substr($resultsrow[1],0,500))) . "...</
description>\r\n";
echo " <link>";
echo htmlspecialchars("http://www.westyorksprobation.org.uk/
library.php?action=accsearch&string=".$resultsrow[3]);
echo" </link>\r\n";
echo " <guid isPermaLink=\"true\">";

echo htmlspecialchars("http://www.westyorksprobation.org.uk/
library.php?action=accsearch&string=".$resultsrow[3]);

echo" </guid>\r\n";

echo " <pubDate>" . date("D, d M Y H:i:s
O",strtotime($resultsrow[2])) . "</pubDate>\r\n";
echo " </item>\r\n";
echo "\r\n";
}
echo " </channel>\r\n";
echo " </rss>\r\n";
}
include("includes/disconnect.php");
exit;


Steve
Guest
 
Posts: n/a
#2: Apr 11 '07

re: Magpie RSS Rejects PHP generated RSS Feed


By the way, I have dug a bit further and the Magpie is reporting:
Failed to fetch http://www.westyorksprobation.org.uk...p?type=Library
(HTTP Response: HTTP/1.1 404)

But the file definitely exists...

Alvaro G. Vicario
Guest
 
Posts: n/a
#3: Apr 11 '07

re: Magpie RSS Rejects PHP generated RSS Feed


*** Steve escribió/wrote (11 Apr 2007 13:26:09 -0700):
Quote:
Can any see why Magpie RSS won't accept this RSS Feed (that is valid
according to the Feed Validator website).
What validator are you using? The W3C Validator warns about four errors:


This feed does not validate.

*

line 127, column 10: 'utf8' codec can't decode byte 0xa3 in position
5295: unexpected code byte (maybe a high-bit character?) [help]

Band 1 - ?12,658 - ?15,374<br />
^

*

line 4, column 62: XML parsing error: expecting ';' [help]

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
^

*

line 5, column 0: Undefined root element: xhtml:html [help]

<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xml:lang="en">

*

line 59, column 63: XML parsing error: <unknown>:59:63: not
well-formed (invalid token) [help]

<li><a
href="http://www.nprie.info/content.php?pn=1019&feed=http%3A%2F%2 ...
^

In addition, this feed has an issue that may cause problems for some users.
We recommend fixing this issue.

*

Feeds should not be served with the "text/html" media type [help]



http://validator.w3.org/feed/

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Steve
Guest
 
Posts: n/a
#4: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


On 11 Apr, 21:52, "Alvaro G. Vicario" <webmas...@NOSPAMdemogracia.com>
wrote:
Quote:
What validator are you using? The W3C Validator warns about four errors:
>
Hi I am using

http://www.westyorksprobation.org.uk...p?type=Library

but just tried the W3C one and it validates without problems.

But like I say, Magpie Reports "404" error.

Toby A Inkster
Guest
 
Posts: n/a
#5: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


Steve wrote:
Quote:
Can any see why Magpie RSS won't accept this RSS Feed (that is valid
according to the Feed Validator website).
http://www.westyorksprobation.org.uk...p?type=Library
Valid it may well be, but RSS it is certainly not. It's an XHTML file
without even a hint of RSSness.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Steve
Guest
 
Posts: n/a
#6: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


I think we must be looking at different files.

When I follow the link (http://www.westyorksprobation.org.uk/rss.php?
type=Library ) I definitely get an RSS XML file that validates
according to the W3C RSS Feed Validator.

If you get something different - could you dump the output into an
email and send it to me? I'm totally perplexed.

Many thanks.



Toby A Inkster
Guest
 
Posts: n/a
#7: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


Steve wrote:
Quote:
When I follow the link (http://www.westyorksprobation.org.uk/rss.php?
type=Library ) I definitely get an RSS XML file that validates
according to the W3C RSS Feed Validator.
I must be going crazy, as it looks fine now. However, on a hunch, I tried:

http://www.westyorksprobation.org.uk...p?type=library

and that's the XHTML file I was looking at before!

I can't see anything *obviously* wrong with the feed (though indenting the
root element is not to my taste). Perhaps the problem is not with the feed
but with the code that's trying to parse it. Magpie RSS itself has always
seemed pretty reliable to me -- what about the script that's making use of
Magpie?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Alvaro G. Vicario
Guest
 
Posts: n/a
#8: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


*** Steve escribió/wrote (11 Apr 2007 13:51:42 -0700):
Quote:
By the way, I have dug a bit further and the Magpie is reporting:
Failed to fetch http://www.westyorksprobation.org.uk...p?type=Library
(HTTP Response: HTTP/1.1 404)
>
But the file definitely exists...
Could Magpie's IP be blacklisted somewhere :-?


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
VS
Guest
 
Posts: n/a
#9: Apr 12 '07

re: Magpie RSS Rejects PHP generated RSS Feed


I appear to get re-directed to the page at
http://www.westyorksprobation.org.uk/index.php

However:

http://www.westyorksprobation.org.uk...p?type=Library

looks ok.

(I have not checked the validity).

--
VS
Closed Thread