Magpie RSS Rejects PHP generated RSS Feed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Magpie RSS Rejects PHP generated RSS Feed

    Can any see why Magpie RSS won't accept this RSS Feed (that is valid
    according to the Feed Validator website).



    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>" . htmlspecialchar s($title) . "</title>\r\n";
    echo " <link>".htmlspe cialchars("http ://
    www.westyorkspr obation.org.uk/")."</link>\r\n";
    echo " <description>RS S Feed for the " . htmlspecialchar s($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>Copy right " . date("Y",time() ) . " West Yorkshire
    Probation Board</copyright>\r\n" ;

    while($resultsr ow=mysql_fetch_ row($result))
    {
    echo " <item>\r\n";
    echo " <title>" . htmlspecialchar s($resultsrow[0]) . "</title>\r
    \n";
    echo " <description> " .
    htmlspecialchar s(strip_tags(su bstr($resultsro w[1],0,500))) . "...</
    description>\r\ n";
    echo " <link>";
    echo htmlspecialchar s("http://www.westyorkspr obation.org.uk/
    library.php?act ion=accsearch&s tring=".$result srow[3]);
    echo" </link>\r\n";
    echo " <guid isPermaLink=\"t rue\">";

    echo htmlspecialchar s("http://www.westyorkspr obation.org.uk/
    library.php?act ion=accsearch&s tring=".$result srow[3]);

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

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

  • Steve

    #2
    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...

    Comment

    • Alvaro G. Vicario

      #3
      Re: Magpie RSS Rejects PHP generated RSS Feed

      *** Steve escribió/wrote (11 Apr 2007 13:26:09 -0700):
      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.dt d">
      ^

      *

      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://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
      --

      Comment

      • Steve

        #4
        Re: Magpie RSS Rejects PHP generated RSS Feed

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



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

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

        Comment

        • Toby A Inkster

          #5
          Re: Magpie RSS Rejects PHP generated RSS Feed

          Steve wrote:
          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!

          Comment

          • Steve

            #6
            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.



            Comment

            • Toby A Inkster

              #7
              Re: Magpie RSS Rejects PHP generated RSS Feed

              Steve wrote:
              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:



              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!

              Comment

              • Alvaro G. Vicario

                #8
                Re: Magpie RSS Rejects PHP generated RSS Feed

                *** Steve escribió/wrote (11 Apr 2007 13:51:42 -0700):
                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
                --

                Comment

                • VS

                  #9
                  Re: Magpie RSS Rejects PHP generated RSS Feed

                  I appear to get re-directed to the page at


                  However:



                  looks ok.

                  (I have not checked the validity).

                  --
                  VS

                  Comment

                  Working...