Reputation: 427
I need to get the twitter latest feed of the user. i used
https://api.twitter.com/1/statuses/user_timeline.json?oauth_token=ecwmW3pMB8euREHVljdySRexys6c6XYangqEANY&screen_name=twitter_name&count=1
but i get "Rate limit exceeded" cliente could not make 150 request per hour.
I used twitter Oauth request using consumer key, consumer secret , access token and access secret and the code as follows
$oauth_consumer_key="Vqlj7vd9yHo5MZPnWGf3w";
$oauth_nonce="af00a3a26b15ec0178ce0342acc9b392";
$oauth_signature_method="HMAC-SHA1";
$oauth_timestamp="1341408794";
$oauth_token="620811780-30jD4XHWFvp15RcjmxHkLLicFlvMDuNaWp6fKjia";
$oauth_version="1.0";
$oauth_signature=rawurldecode("N6L4VJLJjY%2BPKxoelttqe2GOPAw%3D");
$url = "https://api.twitter.com/1/statuses/user_timeline.json?";
$url .= "screen_name=twitter_name";
$url .= "&oauth_consumer_key=".$oauth_consumer_key."";
$url .= "&oauth_token=".$oauth_token."";
$url .= "&oauth_nonce=".$oauth_nonce."";
$url .= "&oauth_signature_method=".$oauth_signature_method."";
$url .= "&oauth_timestamp=".$oauth_timestamp."";
$url .= "&oauth_version=1.0";
$url .= "&oauth_signature=".$oauth_signature."";
$url .= "&count=1";
$url .= "&include_rts=true";
$url .= "include_entities=true";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: api.twitter.com'));
$json = curl_exec($ch);
curl_close ($ch);
$data = json_decode($json, true);
print_r($json);
still i get the rate limit exceeded error.
could any one help me get twitter latest feed using Oauth.
Thanks.
Upvotes: 0
Views: 1843
Reputation: 12322
From experience Twitter OAuth is hit and miss if you try to handle negotiations yourself. I tried for several weeks to achieve this but kept having errors like 'Rate limit exceeded' and 'Invalid OAuth Key'. I checked out a library and within the same hour I could get statuses, set statuses, send tweets with and without pics etc..
Here's what I'm using now, test it out. It's lightweight and easy to use.
https://github.com/themattharris/tmhOAuth/
Upvotes: 0