Jump to content

Get twitter data in XML form


ak111in

Recommended Posts

Hi, I want to get the list of twitter followers in xml form using the url

 

http://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=amodkumargupta

 

I am using the code

 

<?php
$xml = new SimpleXMLElement('http://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=amodkumargupta',NULL,TRUE);
foreach ($xml->ids->id as $id) {

echo "Found $id<br />";
}
?>

 

But getting the following error:

Warning: SimpleXMLElement::__construct(http://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=amodkumargupta) [simplexmlelement.--construct]: failed to open stream: No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\getids.php on line 2

 

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: I/O warning : failed to load external entity "http://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=amodkumargupta" in C:\xampp\htdocs\getids.php on line 2

 

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\xampp\htdocs\getids.php:2 Stack trace: #0 C:\xampp\htdocs\getids.php(2): SimpleXMLElement->__construct('http://api.twit...', 0, true) #1 {main} thrown in C:\xampp\htdocs\getids.php on line 2

 

 

Someone please help with the error.

Link to comment
https://forums.phpfreaks.com/topic/260132-get-twitter-data-in-xml-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.