Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 1.03 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. public static function get_access_token($oauth_token, $oauth_token_secret, $oauth_vericode)
  3.     {
  4.         $oauth = self::oauth();
  5.  
  6.         $oauth->setNonce($nonce = md5(mt_rand()));
  7.         $oauth->setTimestamp($timestamp = time());
  8.         $oauth->setVersion($version = '1.0');
  9.  
  10.         $oauth->setToken($oauth_token, $oauth_token_secret);
  11.  
  12.         $params = array(
  13.             'oauth_signature_method' => OAUTH_SIG_METHOD_HMACSHA1,
  14.             'oauth_consumer_key'     => self::$consumer_key,
  15.             'oauth_nonce'            => $nonce,
  16.             'oauth_timestamp'        => $timestamp,
  17.             'oauth_token'            => $oauth_token,
  18.             'oauth_version'          => $version,
  19.             'oauth_vericode'         => $oauth_vericode,
  20.         );
  21.  
  22.         $params['oauth_signature'] = $oauth->generateSignature(
  23.             OAUTH_HTTP_METHOD_GET, self::$access_token_url, $params
  24.         );
  25.  
  26.         parse_str(file_get_contents(self::$access_token_url . '?' . http_build_query($params)), $result);
  27.  
  28.         return $result;
  29.     }