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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.