donglin1692 2012-06-05 20:06
浏览 65

通过单个请求检索所有Twitter粉丝

I tried this and even added a cursor but it would still retrieve only the first 100 followers.

<?php
$cursor = -1;
$account_from = 'username';
do
  {
     $json = file_get_contents('http://api.twitter.com/1/statuses/followers/' .   $account_from .'.json?cursor=' . $cursor);

$accounts = json_decode($json);

foreach ($accounts->users as $account)
{

        $a[] = $account->screen_name ; 


}
$cursor = $accounts->next_cursor;


}
 while ($cursor > 0);

 foreach($a as $f) {

         echo $f ; 

   }


?>

Is there a better and simpler way of doing it? Where am i going wrong? help please?

  • 写回答

2条回答 默认 最新

  • doujia5863 2012-06-05 20:12
    关注

    API docs state this request is deprecated:

    This method is deprecated as it will only return information about users who have Tweeted recently. It is not a functional way to retrieve all of a users followers. Instead of using this method use a combination of GET followers/ids and GET users/lookup.

    评论

报告相同问题?