Quantcast
Channel: PHP not parsing wordpress rss feed - Stack Overflow
Viewing all articles
Browse latest Browse all 3

PHP not parsing wordpress rss feed

$
0
0

I have read about a dozen posts on this topic here on SO and all of them refer to the whitespace issue, which I don't have, and feed validator agrees my feed is okay (http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgearmunk.com%2Fblog%2Ffeed%2F)

I am using the following code to parse the rss:

<?php$rss = new DOMDocument();$rss->load('http:/gearmunk.com/blog/feed/');$feed = array();foreach ($rss->getElementsByTagName('item') as $node) {$item = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,);array_push($feed, $item);}$limit = 3;for($x=0;$x<$limit;$x++) {$title = str_replace('& ', '&amp; ', $feed[$x]['title']);$link = $feed[$x]['link'];$description = $feed[$x]['desc'];$date = date('l F d, Y', strtotime($feed[$x]['date']));echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';echo '<small><em>Posted on '.$date.'</em></small></p>';echo '<p>'.$description.'</p>';}?>

but if you look at http://gearmunk.com/index3.php you will see, on the right, it lists 3 bad dates and no rss data. If I put in another feed URL it works fine, and if I put my rss feed into Google reader it works just fine. I'm hoping there is something stupid simple I'm missing. Can someone help?

thanks,Erik

MORE INFORMATION:

I started to focus in on it being a wordpress problem, so I tried some other wordpress RSS feeds. One from CNN works fine (http://religion.blogs.cnn.com/feed/), however, one from BoingBoing (also a WP site) doesn't work: http://boingboing.net/feed.

I am not getting the XML Parse error normally associated with the whitespace issue, so I don't think that is it.

Erik


Viewing all articles
Browse latest Browse all 3

Trending Articles