You are here

public function Twitter::get_request_token in Twitter 6.5

Same name and namespace in other branches
  1. 7.6 twitter.lib.php \Twitter::get_request_token()
  2. 7.5 twitter.lib.php \Twitter::get_request_token()

File

./twitter.lib.php, line 47
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

Twitter
Primary Twitter API implementation class

Code

public function get_request_token($params = array()) {
  $oauth_callback = variable_get('twitter_oauth_callback_url', TWITTER_OAUTH_CALLBACK_URL);
  $url = variable_get('twitter_api', TWITTER_API) . '/oauth/request_token';
  try {
    $params += array(
      'oauth_callback' => url($oauth_callback, array(
        'absolute' => TRUE,
      )),
    );
    $response = $this
      ->auth_request($url, $params);
  } catch (TwitterException $e) {
    watchdog('twitter', '!message', array(
      '!message' => $e
        ->__toString(),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  parse_str($response, $token);
  $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
  return $token;
}