I am new to twitter API started working on it on PHP using this library .
// connecting to it and asking for user look up
$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "https://api.twitter.com/1/";
$userInfo= $twitter->post( 'users/lookup', array('user_id' => "".$id)); // i am talking about this line
here I am calling users/lookup for each id I have (I know I can put multiple ids comma seprated) but I didn't know that before; any way I noticed I get the rate limit of 150 calls why can't I do more? it should 350 calls since I am using Oauth, is this correct?
What am I doing wrong?
Lots of problems in your code.
1.0
. users/lookup
is not available in 1.0
. Its introduced in 1.1
. Use endpoint https://api.twitter.com/1.1/
first. user/lookup
is a GET
request not POST
. see GET user/lookup . Use $twitter->get()
method. GET users/lookup
is 180
per 15
minute window. Thats 720
per hour. See REST API V1.1 Limits Your final code should something like this,
$twitter->host = "https://api.twitter.com/1.1/";
$userInfo= $twitter->get( 'users/lookup', array('user_id' => "".$id));
@shiplu.mokadd.im users/lookup existed in v 1.0 also.
I'm having the same problem with v1, but it seems to be a common problem recently.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.