Jump to content

How to fetch all followers of a random user of twitter?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
jaojao

jaojao

    Newbie

  • Members
  • Pip
  • 2 posts
Hi,
I have written a php to fetch followers of a given username of twitter by using twitter API.
But the result is limited by the number of followers.
For example, there are only 100 followers of BBCWorld listed in result, instead of 367,480.

What is the solution to overcome this limitation?


<?php

$username="BBCWorld"; //input user name of twitter 

$follower_url = "http://api.twitter.com/1/statuses/followers/".$username.".xml";

 

$twFriends = curl_init(); 

curl_setopt($twFriends, CURLOPT_URL, $follower_url);

curl_setopt($twFriends, CURLOPT_RETURNTRANSFER, TRUE);

$twiFriends = curl_exec($twFriends);

$response = new SimpleXMLElement($twiFriends);

 

foreach($response->user as $friends){ 

$thumb = $friends->profile_image_url;

$url = $friends->screen_name;

$name = $friends->name;  

?>

<a title="<?php echo $name;?>" href="http://www.twitter.com/<?php echo $url;?>"><img class="photo-img" src="<?php echo $thumb?>" border="0" alt="" width="40" /></a>

<?php

} 

?>



#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
The official twitter API appears to only allow access to the last 100 followers, I would read up on the documents, I am not familiar with them.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
jaojao

jaojao

    Newbie

  • Members
  • Pip
  • 2 posts

Nullw0rm said:

The official twitter API appears to only allow access to the last 100 followers, I would read up on the documents, I am not familiar with them.

Thanks,
Yes, it's what I am worried about.
So I think, may be you know another way to crawler all followers, either with or without using twitter API.