Parsing RSS2 In PHP

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:

Read More
$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!

Related posts

Leave a Reply

2 comments