Twitter get followers/ids curosr not working -
I am trying to get the full list of follower ID for a Twitter user. This user has 170,000+ followers, I am using Code Birds Library. Here's the code:
\ Codebird \ Codebird :: setConsumerKey (TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET); $ cb = \ Codebird \ Codebird :: getInstance (); $ Cb- & gt; Settoken (OAUTH_TOKEN, OAUTH_SECRET); $ Cb- & gt; SetReturnFormat (CODEBIRD_RETURNFORMAT_ARRAY); $ Next_cursor = -1; While ($ next_cursor) {$ result = $ cb-> Follower_ids ("screen_name = some_tw_name", "count = 5000", "cursor = $ next_cursor"); $ Next_cursor = $ result ['next_cursor_str']; } The first call returns 5000 ids, because it is considered. Later calls (while through the loop) return 5000 IDs, but they are almost like all previous calls (each new call I get about 10 news IDs from 1, with the rest like before).
Anyone run into this issue? oath? I think the problem is that you are not actually combining results with each request. You can do something like this:
function getFollowers () {$ next_cursor = -1; $ Output = array (); While ($ next_cursor) {$ results = $ cb-> Follower_ids (array ("screen_name" = & gt; "some_tw_name", "count" => 5000, "cursor" => gt; $ next_cursor)); If (! Isset ($ result ['Errors'])) {foreach ($ result ['id'] $ id) {$ output [] = $ id; }} $ next_cursor = $ result ['next_cursor_str']; } Return $ Output; } Note: I have changed the logic symbol in an array against the strings.
Comments
Post a Comment