Parsing RSS2 In PHP
Posted
by mrduclaw
on Stack Overflow
See other posts from Stack Overflow
or by mrduclaw
Published on 2010-03-30T15:54:50Z
Indexed on
2010/04/03
21:23 UTC
Read the original article
Hit count: 393
I'm trying to get content from an RSS2 feed from one of my sites and use it in another site.
The feed is here. And the code I'm using is taken from this nice site and has been modified like the following:
$doc = new DOMDocument();
$doc->load('http://tripleax.com/john/?feed=rss2');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
print('<div style="width:100%" class="option"><strong>');
$a = $node->getElementsByTagName('title')->item(0)->nodeValue;
print("$a");
print('</strong><br /><span class="option">');
$a = $node->getElementsByTagName('description')->item(0)->nodeValue;
print("$a");`
}
The problem I'm having is, I want to display the entire post's contents. And the description is a sort of the teaser. Changing $node->getElementsByTagName('description')->item(0)->nodeValue
to $node->getElementsByTagName('content')->item(0)->nodeValue
gives me nothing, and content:encoded
is no better.
Can someone please point me in the right direction to solving this?
Thanks!
© Stack Overflow or respective owner