Unable to fetch twitter response(after login) using php


#1

I want to display some use information onto my website but it shows error.
Here is my code :—

<?php if (!empty($_GET['oauth_verifier']) && !empty($_SESSION['oauth_token']) && !empty($_SESSION['oauth_token_secret'])) { $twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $access_token = $twitteroauth->getAccessToken($_GET['oauth_verifier']); $_SESSION['access_token'] = $access_token; $user_info = $twitteroauth->get('account/verify_credentials'); $user_info_tw = json_decode( json_encode($user_info), true); if (isset($user_info->error)) { header('Location: login-twitter.php'); }else { $twitter_otoken=$_SESSION['oauth_token']; $twitter_otoken_secret=$_SESSION['oauth_token_secret']; $email=''; print_r($user_info_tw);// echo $uid = $user_info_tw['id']; echo $username = $user_info_tw['name']; $tUserScreenName=$user_info_tw['screen_name']; $tfollowers_count=$user_info_tw['followers_count']; $tfriends_count=$user_info_tw['friends_count']; $tfavourites_count=$user_info_tw['favourites_count']; $tstatuses_count=$user_info_tw['statuses_count']; $tprofile_image_url=$user_info_tw['profile_image_url']; $tprofile_image_url_https=$user_info_tw['profile_image_url_https']; $tfollowing=$user_info_tw['following']; $user = new User(); $userdata = $user->checkUser($uid,$username,$email,$tUserScreenName,$tfollowers_count,$tfriends_count,$tfavourites_count,$tstatuses_count,$tprofile_image_url, $tprofile_image_url_https,$tfollowing,$twitter_otoken,$twitter_otoken_secret); if(isset($_SESSION['oauth_id']) && isset( $_SESSION['username'])){ echo "Welcome ".$_SESSION['username']; } } }else{ header('Location: login-twitter.php'); } ?>

OUTPUT:–>
Array ( [errors] => Array ( [0] => Array ( [message] => Rate limit exceeded [code] => 88 ) ) )

its inserted into database successfully but with error .Where i did wrong?Please reply.


#2

You are calling the API too frequently. You need to hold off and stay within the published rate limits.


#3

ok.Thanks