Re: Pear XML parser finding nothing in ATOM / Movable Type feed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Allsopp wrote:
Hi

I know nothing about Pear, so I don't know how to debug this:

I've got a newly installed Movable Type blog with a couple of entries in it, and I just found from php.net the pear classes to parse an RSS feed, parser.php and rss.php, and this code from the PEAR site works

require_once "XML/RSS.php";

$rss =& new XML_RSS("http://rss.slashdot.org/Slashdot/slashdot";);
$rss->parse();

echo "<h2>Headlines from slashdot</h2>\n";
echo "<ul>\n";

foreach ($rss->getItems() as $item) {
echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n";
}

echo "</ul>\n";

but if I point it at my blog: http://www.bluetreeservices.co.uk/gps_tracking_news/atom.xml or http://www.bluetreeservices.co.uk/gps_tracking_news/ or http://www.bluetreeservices.co.uk/gps_tracking_news , parse returns an empty array.

Am I just using the wrong code for that type of feed (I would have thought any RSS reader would handle an atom format feed) or is it that my server needs to provide atom.xml or .. what's going on?

I've no idea how to use PEAR::error with regard to $rss->parse() so I'm a bit stumped about debugging it.

I'd certainly call myself a PHP programmer, but I've never really used pear is the thing.

All help appreciated :-)

Cheers
J

Atom and RSS are completely different; the only similarities lie in the fact they are both XML, and both used frequently for syndicating news.

You need an atom parser; or just load the feed into DOMDocument..

SimplePie and RssPhp are the only two I know that handle atom feeds well.

regards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux