PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
<?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>");
}
?>
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
You'll probably get errors about URL file access disabled. This is a php.ini directive: allow_url_fopen
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
ew123 wrote:I don't have access to the php.ini file
Then you are out of luck. Ask your host to enable it or change hosts. You may be able to use cURL if it is available and fetch the XML.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.