You are here

public function Twitter::auth_request in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \Twitter::auth_request()
  2. 6.3 twitter.lib.php \Twitter::auth_request()
  3. 7.6 twitter.lib.php \Twitter::auth_request()
  4. 7.3 twitter.lib.php \Twitter::auth_request()

Performs an authenticated request.

3 calls to Twitter::auth_request()
Twitter::getParsedResponse in ./twitter.lib.php
Retrieves the parsed response of the Twitter API endpoint call.
Twitter::get_access_token in ./twitter.lib.php
Request an access token to the Twitter API.
Twitter::get_request_token in ./twitter.lib.php

File

./twitter.lib.php, line 110
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 auth_request($url, $params = array(), $method = 'GET') {
  $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $params);
  $request
    ->sign_request($this->signature_method, $this->consumer, $this->token);
  try {
    switch ($method) {
      case 'GET':
        return $this
          ->request($request
          ->to_url());
      case 'POST':
        return $this
          ->request($request
          ->get_normalized_http_url(), $request
          ->get_parameters(), 'POST');
    }
  } catch (TwitterException $e) {
    watchdog('twitter', '!message', array(
      '!message' => $e
        ->__toString(),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
}