What are the steps to authorize the Twitter v1.1 API for your Twitter account?

| | 1 min read

I am here to help you how to work with twitter API v1.1 because Version 1.0 will be deprecated. In Version, v1.1 need a authorization to work with. For the authorization, we need to create a Twitter APP first. Steps for authorization is listed below.

  1. Go to twitter's website dev.twitter.com.

    Create a new twitter account.

  2. Go to the path apps.twitter.com. Now we are in to Twitter’s app website. We can also enter in to this website by clicking 'manage your apps' in the footer of the Twitter Developers site.
  3. Create a New Twitter App

    To create a new twitter App, click button 'Create a new application' which will redirect into app registration form.

  4. Create your Access Token

    We now need to authorize the Twitter app for your Twitter account.Click the 'Create my access token' button. Now access tokens are created.

Now we can look on to the simple example how to get list of all followers using Twitter V1.1 using PHP.

require_once('TwitterAPIExchange.php');
$conf = array(
    'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
    'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
    'consumer_key' => "YOUR_CONSUMER_KEY",
    'consumer_secret' => "YOUR_CONSUMER_SECRET"
);
$url = 'https://api.twitter.com/1.1/followers/list.json';
$getfield = '?username=J7mbo&skip_status=1';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($conf);
$response = $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest(); 
print_r($response);

Hope you got some ideas about this, if you have any doubts, ping us immediately. For any service help, click here.