I'm getting Fatal error: Call to a member function getElementsByTagName() now when I'm trying to pull in the RSS feed from my wordpress blog. Here's the code I'm using to get the RSS feed (which has worked up until recently):
$xmlDoc = new DOMDocument();
@$xmlDoc->load('http://www.revolutionpersonaltraining.com.au/blog/feed/');
$x = $xmlDoc->getElementsByTagName('item');
for ($i=0; $i<6; $i++):
$items[$i]['date'] = strftime("%Y-%m-%d %H:%M:%S", strtotime($x->item($i)->getElementsByTagName('pubDate')->item(0)->childNodes->item(0)->nodeValue));
$items[$i]['title'] = $x->item($i)->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;
$items[$i]['link'] = $x->item($i)->getElementsByTagName('link')->item(0)->childNodes->item(0)->nodeValue;
$items[$i]['desc'] = $x->item($i)->getElementsByTagName('encoded')->item(0)->childNodes->item(0)->nodeValue;
endfor;
If anyone could shed any light on this, that would be fantastic.
You can use this way :
Good Luck