Jump to content

Parsing RSS feeds...


Arty Ziff

Recommended Posts

I'm using the following code to grab an RSS feed and parse it into an array:

$doc = new DOMDocument();
$doc->load('http://MySite.com/feed/');

$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array ( 
	'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
	'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
	'link' => $node->getElementsByTagName('link')->item(1)->nodeValue,
	'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}

My problem is that there is one tag I'd like to access, but don't quite know how...

 

It is: <content:encoded>

 

I've looked at

 

'content' => $node->getElementsByTagName('content:encoded')->item(1)->nodeValue

 

and

 

'content' => $node->getElementsByTagName('content')->item(1)->nodeValue

 

But neither work.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/248283-parsing-rss-feeds/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.