You are here

function TwitterOAuth::oAuthRequest in Tweet Feed 6

Same name and namespace in other branches
  1. 7.3 inc/twitter-oauth.inc \TwitterOAuth::oAuthRequest()
  2. 7 inc/twitter-oauth.inc \TwitterOAuth::oAuthRequest()
  3. 7.2 inc/twitter-oauth.inc \TwitterOAuth::oAuthRequest()

Format and sign an OAuth / API request

6 calls to TwitterOAuth::oAuthRequest()
TwitterOAuth::delete in inc/twitter-oauth.inc
DELETE wrapper for oAuthReqeust.
TwitterOAuth::get in inc/twitter-oauth.inc
GET wrapper for oAuthRequest.
TwitterOAuth::getAccessToken in inc/twitter-oauth.inc
Exchange request token and secret for an access token and secret, to sign API calls.
TwitterOAuth::getRequestToken in inc/twitter-oauth.inc
Get a request_token from Twitter
TwitterOAuth::getXAuthToken in inc/twitter-oauth.inc
One time exchange of username and password for access token and secret.

... See full list

File

inc/twitter-oauth.inc, line 174

Class

TwitterOAuth
Twitter OAuth class

Code

function oAuthRequest($url, $method, $parameters) {
  if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
    $url = "{$this->host}{$url}.{$this->format}";
  }
  $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
  $request
    ->sign_request($this->sha1_method, $this->consumer, $this->token);
  switch ($method) {
    case 'GET':
      return $this
        ->http($request
        ->to_url(), 'GET');
    default:
      return $this
        ->http($request
        ->get_normalized_http_url(), $method, $request
        ->to_postdata());
  }
}