PHP XML DOM twitter feed
Posted: Wed Jul 07, 2010 9:05 am
I'm trying to list my twitter statuses on a page of my website. I'm using the rss feed. I've had problems using PHP XML DOM before and I tried the fixes to my codes from a precious topic, but it still isn't working.
This code:
Produces this error:
Fatal error: Call to a member function getElementsByTagName() on a non-object in /www/sites/7e1/c10/www.georgewright.me.uk/web/twitterfeed.php on line 10
Does anybody know why and how to fix it?
Thanks
This code:
Code: Select all
<?php
$xmlDocOne = new DOMDocument();
$xmlDocOne->load("http://twitter.com/statuses/user_timeline/88436402.rss");
//get and output "<item>" elements
$xOne=$xmlDocOne->getElementsByTagName('item');
for ($iOne=0; $iOne<2; $iOne++)
{
$item_titleOne=$xOne->item($iOne)->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$item_linkOne=$xOne->item($iOne)->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$item_descOne=$xOne->item($iOne)->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;
echo ("<li>" . $item_titleOne . "</li>");
}
?>Fatal error: Call to a member function getElementsByTagName() on a non-object in /www/sites/7e1/c10/www.georgewright.me.uk/web/twitterfeed.php on line 10
Does anybody know why and how to fix it?
Thanks