Note that there are some explanatory texts on larger screens.

plurals
  1. POTwitter API User Lookup 1000 users
    primarykey
    data
    text
    <p>I'm trying to fetch 1000+ Twitter users from my database using <a href="http://api.twitter.com/1/users/lookup.format" rel="nofollow">this API call</a>. However, Twitter lookup only allows 100 users per call, so how can I do it with 10 calls?</p> <p>If I have 2232 users in my DB and I want to do a lookup on all users and get their details how to do it? Something which will count all the users being searched, break it into array of 100 elements, make the call for 100, and add the response back to database and then move onto the next 100.</p> <p>I am using the <code>tmhOAuth</code> library for Twitter.</p> <p>EDITED: I was able to accomplish it using this code , but my next question is how can i bind those values back to my account ? because the screen_name is a entry and not the KEY of the array, so how can i do it ? </p> <pre><code> $accounts = $this-&gt;accounts-&gt;getAll(); $accounts_chunk = array_chunk($accounts,100); foreach($accounts_chunk as $accounts){ $screen_names = ""; $last_key = end(array_keys($accounts)); foreach($accounts as $k =&gt; $account){ $screen_names .= $account-&gt;screen_name; if($last_key == $k){ $screen_names .= ""; } else { $screen_names .= ","; } } $code = $this-&gt;twitter-&gt;request('GET', $this-&gt;twitter-&gt;url("1/users/lookup"),array('screen_name' =&gt; $screen_names)); echo "&lt;pre&gt;";print_r(json_decode($this-&gt;twitter-&gt;response));echo "&lt;/pre&gt;"; } </code></pre> <p>But how to update values in DB using this .. i did a check but the sequence of the responses always changes so cannot use the current keys .. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload