/** * @return Response */ protected function getResponse() { $responseInfo = $this->oAuthClient->getLastResponseInfo(); $response = Response::createFromRaw($responseInfo['headers_recv']); $response->appendContent($this->oAuthClient->getLastResponse()); return $response; }
private static function makeRequestAndPrintResponse($method, $params, $signature_method = OAUTH_SIG_METHOD_HMACSHA1) { $oauth = new OAuth(Settings::$USOSAPI_CONSUMER_KEY, Settings::$USOSAPI_CONSUMER_SECRET, $signature_method, OAUTH_AUTH_TYPE_URI); if ($signature_method == OAUTH_SIG_METHOD_PLAINTEXT) { $oauth->setRequestEngine(OAUTH_REQENGINE_CURL); } if (Settings::$DEBUG) { $oauth->enableDebug(); } $url = Settings::$USOSAPI_BASE_URL . $method; try { $oauth->fetch($url, $params, OAUTH_HTTP_METHOD_POST); } catch (OAuthException $E) { /* Ignored on purpose. $response_info will be filled either way. */ } $response_info = $oauth->getLastResponseInfo(); header("HTTP/1.0 {$response_info["http_code"]}"); header("Content-Type: {$response_info["content_type"]}"); print $oauth->getLastResponse(); }
function SendTweet($msg) { if ($msg == '') { return false; } DebugMessage('Sending tweet of ' . strlen($msg) . " chars:\n" . $msg); global $twitterCredentials; if ($twitterCredentials === false) { return true; } $params = array(); $params['status'] = $msg; $oauth = new OAuth($twitterCredentials['consumerKey'], $twitterCredentials['consumerSecret']); $oauth->setToken($twitterCredentials['WoWTokens']['accessToken'], $twitterCredentials['WoWTokens']['accessTokenSecret']); $url = 'https://api.twitter.com/1.1/statuses/update.json'; try { $didWork = $oauth->fetch($url, $params, 'POST', array('Connection' => 'close')); } catch (OAuthException $e) { $didWork = false; } $ri = $oauth->getLastResponseInfo(); $r = $oauth->getLastResponse(); if ($didWork && $ri['http_code'] == '200') { $json = json_decode($r, true); if (json_last_error() == JSON_ERROR_NONE) { if (isset($json['id_str'])) { return $json['id_str']; } } return true; } if (isset($ri['http_code'])) { DebugMessage('Twitter returned HTTP code ' . $ri['http_code'], E_USER_WARNING); } else { DebugMessage('Twitter returned unknown HTTP code', E_USER_WARNING); } DebugMessage('Twitter returned: ' . print_r($ri, true), E_USER_WARNING); DebugMessage('Twitter returned: ' . print_r($r, true), E_USER_WARNING); return false; }
<?php include "config/settings.inc.php"; $oauth = new OAuth(PWNED_CONSUMER_KEY, PWNED_CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI); //initiate $oauth_token_info = unserialize(file_get_contents(PWNED_OAUTH_TMP_DIR . "/access_token_resp")); $oauth->setToken($oauth_token_info['oauth_token'], $oauth_token_info['oauth_token_secret']); $api_args = array("status" => "This is my first status update from the API!"); try { $oauth->fetch("http://api.pwned.com/me/status", $api_args, OAUTH_HTTP_METHOD_POST, array("User-Agent" => "pecl/oauth")); //this will update the users status //$oauth->fetch("http://api.pwned.com/me/status", null, OAUTH_HTTP_METHOD_POST, array("User-Agent" => "pecl/oauth")); //this will return the users status updates $response_info = $oauth->getLastResponseInfo(); $res = $oauth->getLastResponse(); $array_res = json_decode($res); print_r($array_res); } catch (OAuthException $E) { echo "Exception caught!\n"; echo "Response: " . $E->lastResponse . "\n"; }
public function flow() { if (isset($_GET['oauth_token'])) { $consumerKey = $_GET['oauth_consumer_key']; $consumerSecret = $_GET['oauth_consumer_secret']; $token = $_GET['oauth_token']; $tokenSecret = $_GET['oauth_token_secret']; $verifier = $_GET['oauth_verifier']; try { $consumer = getDb()->getCredential($token); $oauth = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); $oauth->setVersion('1.0a'); $oauth->setToken($token, $tokenSecret); $accessToken = $oauth->getAccessToken(sprintf('%s://%s/v1/oauth/token/access', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST']), null, $verifier); $accessToken['oauth_consumer_key'] = $consumerKey; $accessToken['oauth_consumer_secret'] = $consumerSecret; setcookie('oauth', http_build_query($accessToken)); if (!isset($accessToken['oauth_token']) || !isset($accessToken['oauth_token_secret'])) { echo sprintf('Invalid response when getting an access token: %s', http_build_query($accessToken)); } else { echo sprintf('You exchanged a request token for an access token<br><a href="?reloaded=1">Reload to make an OAuth request</a>', $accessToken['oauth_token'], $accessToken['oauth_token_secret']); } } catch (OAuthException $e) { $message = OAuthProvider::reportProblem($e); getLogger()->info($message); OPException::raise(new OPAuthorizationOAuthException($message)); } } else { if (!isset($_GET['reloaded'])) { $callback = sprintf('%s://%s/v1/oauth/flow', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST']); $name = isset($_GET['name']) ? $_GET['name'] : 'OAuth Test Flow'; echo sprintf('<a href="%s://%s/v1/oauth/authorize?oauth_callback=%s&name=%s">Create a new client id</a>', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], urlencode($callback), urlencode($name)); } else { try { parse_str($_COOKIE['oauth']); $consumer = getDb()->getCredential($oauth_token); $oauth = new OAuth($oauth_consumer_key, $oauth_consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); $oauth->setToken($oauth_token, $oauth_token_secret); $oauth->fetch(sprintf('http://%s/v1/oauth/test?oauth_consumer_key=%s', $_SERVER['HTTP_HOST'], $oauth_consumer_key)); $response_info = $oauth->getLastResponseInfo(); header("Content-Type: {$response_info["content_type"]}"); echo $oauth->getLastResponse(); } catch (OAuthException $e) { $message = OAuthProvider::reportProblem($e); getLogger()->info($message); OPException::raise(new OPAuthorizationOAuthException($message)); } } } }
function get_data($url, $params = array(), $format = 'json', $http = array(), $cache = TRUE) { unset($this->response, $this->data, $this->xpath); if (!isset($http['method'])) { $http['method'] = 'GET'; } if ($cache && $this->cache) { // can set either of these to FALSE to disable the cache if ($http['method'] === 'GET') { // only use the cache for GET requests (TODO: allow caching of some POST requests?) return $this->get_cached_data($url, $params, $format, $http); } } // FIXME: is this a good idea? if ($http['method'] === 'POST' && empty($http['content']) && !empty($params)) { $http['content'] = http_build_query($params); $params = array(); } if (!empty($params)) { ksort($params); $url .= '?' . http_build_query($params); } if (isset($http['file'])) { $http['content'] = file_get_contents($http['file']); } // TODO: allow setting default HTTP headers in Config.php if (!isset($http['header']) || !preg_match('/Accept: /', $http['header'])) { $http['header'] .= (empty($http['header']) ? '' : "\n") . $this->accept_header($format); } $http['header'] .= (empty($http['header']) ? '' : "\n") . "Connection: close"; //debug($http); //$http['header'] = ''; $context = empty($http) ? NULL : stream_context_create(array('http' => $http)); if (!empty($this->oauth)) { $oauth = new OAuth($this->oauth['consumer_key'], $this->oauth['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI); $oauth->enableDebug(); $oauth->setToken($this->oauth['token'], $this->oauth['secret']); try { $headers = explode("\n", $http['header']); $http['header'] = array(); foreach ($headers as $value) { if (preg_match('/^\\s*(.+?):\\s*(.+)/', $value, $matches)) { $http['header'][$matches[1]] = trim($matches[2]); } } $oauth->fetch($url, $http['content'], constant('OAUTH_HTTP_METHOD_' . $http['method']), $http['header']); $this->response = $oauth->getLastResponse(); //debug($this->response); $info = $oauth->getLastResponseInfo(); //debug($info); $this->http_response_header = explode("\n", $info['headers_recv']); //debug($this->http_response_header); } catch (OAuthException $e) { debug($oauth->debugInfo); } } else { debug_log('Sending request to ' . $url); debug('Sending request to ' . $url); //debug(array($url, $http)); $this->response = file_get_contents($url, false, $context); $this->http_response_header = $http_response_header; } //debug($this->http_response_header); $this->parse_http_response_header(); $this->parse_effective_url($url); debug('Received response from ' . $this->http_effective_url); debug_log('Received response from ' . $this->http_effective_url); //debug_log($this->response); if ($this->response !== false) { try { $this->data = $this->format_data($format); $this->validate_data($format); } catch (DataException $e) { $e->errorMessage(); } catch (Exception $e) { debug($e->getMessage()); } } return $this->data; }
$_SESSION['oaccess_oauth_token'] = $access_token_info['oauth_token']; $_SESSION['oaccess_oauth_token_secret'] = $access_token_info['oauth_token_secret']; } } if (isset($_SESSION['oaccess_oauth_token'])) { //now fetch current users speeddial data $access_token = $_SESSION['oaccess_oauth_token']; $access_token_secret = $_SESSION['oaccess_oauth_token_secret']; $oauthc->setToken($access_token, $access_token_secret); // make the request try { $data = $oauthc->fetch('https://link.api.opera.com/rest/speeddial/children/'); } catch (OAuthException $e) { echo "The response information:"; echo "<pre>"; print_r($oauthc->getLastResponseInfo()); echo "</pre>"; echo "The response body:"; echo "<pre>"; print_r($oauthc->getLastResponse()); echo "</pre>"; echo "The PHP exception info:"; echo "<pre>"; echo $e; echo "</pre>"; } $response_info = $oauthc->getLastResponse(); // print out the speeddial data $json_data_array = json_decode($response_info, true); uasort($json_data_array, function ($a, $b) { $apos = $a["id"];
die("Invalid BODY; Must be JSON or empty"); } $additional_errors = null; $OAuth = new OAuth($consumerKey, $consumerSecret); $OAuth->setToken($token, $tokenSecret); $OAuth->enableDebug(); if ($self_signed) { $OAuth->disableSSLChecks(); } try { $result = $OAuth->fetch($apiURL . $endpoint, $body, $method, array('X-Api-Version' => '1', 'Accept' => 'application/json')); } catch (OAuthException $E) { $additional_errors = $E->getMessage(); } $response_body = $OAuth->getLastResponse(); $response = $OAuth->getLastResponseInfo(); $debug = $OAuth->debugInfo; if (strpos($response['content_type'], 'image/') === 0) { header("Content-Type: {$response['content_type']}"); echo $response_body; exit; } ?> <style> body h1 { color: red; } body.S200 h1, body.S201 h1, body.S204 h1 { color: green;
<?php /** * This is a simple test file to verify the state and correctness of the Provider code. * * @Author Freek Lijten */ require_once __DIR__ . '/config.php'; session_start(); try { $OAuth = new OAuth($consumerKey, $consumerSecret); $tokenInfo = $OAuth->getRequestToken($requestURL . '?oauth_callback=' . $callbackURL . '&scope=all'); } catch (Exception $E) { echo '<pre>'; var_dump($E->getMessage()); var_dump($OAuth->getLastResponse()); var_dump($OAuth->getLastResponseInfo()); echo '</pre>'; } if (empty($tokenInfo['oauth_token_secret']) || empty($tokenInfo['oauth_token'])) { echo '<pre>'; var_dump($tokenInfo); echo '</pre>'; exit; } $_SESSION['oauth_token_secret'] = $tokenInfo['oauth_token_secret']; $location = $authorizeURL . '?oauth_token=' . $tokenInfo['oauth_token']; header('Location: ' . $location);
// $body_json = json_encode($body); // $oauth->fetch($api_url, $body_json, OAUTH_HTTP_METHOD_POST, array("Content-Type" => "application/json","x-li-format" => "json"));; // // $oauth->fetch($api_url, null, OAUTH_HTTP_METHOD_GET, array("Content-Type" => "application/json","x-li-format" => "json")); // }catch (Exception $e){ // echo $e; // // echo $acc_data->user_at."___"; // // echo $acc_data->user_ts; // } // // }else{ $api_url = "http://api.linkedin.com/v1/people/~/current-status"; $oauth->fetch($api_url, '<?xml version="1.0" encoding="UTF-8"?><current-status>' . $_POST['request'] . '</current-status>', OAUTH_HTTP_METHOD_PUT, array('Content-Type' => 'application/xml')); // } $response = $oauth->getLastResponse(); // just a sample of how you would get the response $re = $oauth->getLastResponseInfo(); // echo $response; // echo json_encode($re); if ($re['http_code'] == 204) { echo "SUCCESS"; } else { echo "UNKNOWN_ERROR"; } } } break; //TODO where is this used? //TODO where is this used? case 'getLNCMP': $acc_data = $api->getAccountData($_POST['i'], $_POST['j']); if ($acc_data == 'reload') {
function SendTweet($region, $tweetData, $chartUrl, $lastTweetData) { global $regionNames; $msg = isset($regionNames[$region]) ? $regionNames[$region] : $region; $msg .= " WoW Token: " . $tweetData['formatted']['BUY'] . "g."; //, sells in " . $tweetData['formatted']['TIMETOSELL'] . '.'; if ($tweetData['timestamp'] < time() - 30 * 60) { // show timestamp if older than 30 mins $msg .= " From " . TimeDiff($tweetData['timestamp'], ['parts' => 2, 'precision' => 'minute']) . '.'; } if ($tweetData['record']['result'] != 1) { $msg .= " " . $tweetData['formatted']['RESULT'] . "."; } else { if (isset($tweetData['formatted']['BUYCHANGEAMOUNT']) && $tweetData['formatted']['BUYCHANGEAMOUNT'] != '0') { $msg .= " Changed " . $tweetData['formatted']['BUYCHANGEAMOUNT'] . 'g'; if (isset($tweetData['formatted']['BUYCHANGEPERCENT'])) { $msg .= ' or ' . $tweetData['formatted']['BUYCHANGEPERCENT']; if (isset($lastTweetData['timestamp'])) { $msg .= ' since ' . round((time() - $lastTweetData['timestamp']) / 3600, 1) . 'h ago'; } } elseif (isset($lastTweetData['timestamp'])) { $msg .= ' since ' . round((time() - $lastTweetData['timestamp']) / 3600, 1) . 'h ago'; } $msg .= '.'; } if (isset($tweetData['formatted']['TURNAROUND'])) { $msg .= ' ' . $tweetData['formatted']['TURNAROUND']; } } if ($msg == '') { return false; } DebugMessage('Sending tweet of ' . strlen($msg) . " chars:\n" . $msg); global $twitterCredentials; if ($twitterCredentials === false) { return true; } $media = false; if ($chartUrl) { $media = UploadTweetMedia($chartUrl); } $params = array(); if ($media) { $params['media_ids'][] = $media; } $params['status'] = $msg; $oauth = new OAuth($twitterCredentials['consumerKey'], $twitterCredentials['consumerSecret']); $oauth->setToken($twitterCredentials['WoWTokens']['accessToken'], $twitterCredentials['WoWTokens']['accessTokenSecret']); $url = 'https://api.twitter.com/1.1/statuses/update.json'; try { $didWork = $oauth->fetch($url, $params, 'POST', array('Connection' => 'close')); } catch (OAuthException $e) { $didWork = false; } $ri = $oauth->getLastResponseInfo(); $r = $oauth->getLastResponse(); if ($didWork && $ri['http_code'] == '200') { $json = json_decode($r, true); if (json_last_error() == JSON_ERROR_NONE) { if (isset($json['id_str'])) { return $json['id_str']; } } return true; } if (isset($ri['http_code'])) { DebugMessage('Twitter returned HTTP code ' . $ri['http_code'], E_USER_WARNING); } else { DebugMessage('Twitter returned unknown HTTP code', E_USER_WARNING); } DebugMessage('Twitter returned: ' . print_r($ri, true), E_USER_WARNING); DebugMessage('Twitter returned: ' . print_r($r, true), E_USER_WARNING); return false; }
$oauthClient->enableDebug(); if (!isset($_GET['oauth_token']) && !$_SESSION['state']) { $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl); $_SESSION['secret'] = $requestToken['oauth_token_secret']; $_SESSION['state'] = 1; header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']); exit; } elseif ($_SESSION['state'] == 1) { $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']); $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl); $_SESSION['state'] = 2; $_SESSION['token'] = $accessToken['oauth_token']; $_SESSION['secret'] = $accessToken['oauth_token_secret']; header('Location: ' . $callbackUrl); exit; } else { echo json_encode($_SESSION); exit; $accessToken = 'b9611bfcef5f3fcf2d0d1b1275854a06'; $accessSecret = '5380178875df4ab3856e54badd4af76c'; $oauthClient->setToken($accessToken, $accessSecret); //$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']); $resourceUrl = $apiUrl . 'products'; $params = array('limit' => 5); $headers = array('Content-Type' => 'application/json'); $oauthClient->fetch($resourceUrl, $params, OAUTH_HTTP_METHOD_GET, $headers); print_r($oauthClient->getLastResponseInfo()); } } catch (OAuthException $e) { print_r($e); }
$request_token = $req_token['oauth_token']; $request_token_secret = $req_token['oauth_token_secret']; $oauth->setToken($request_token, $request_token_secret); try { $acc_token = $oauth->getAccessToken("http://openapi.etsy.com/{$v2_path}/oauth/access_token", null, $verifier); } catch (OAuthException $e) { error_log($e->getMessage()); error_log(print_r($oauth->getLastResponse(), true)); error_log(print_r($oauth->getLastResponseInfo(), true)); exit; } if (OAUTH_DEBUG) { print "access token info\n"; print_r($acc_token); } // step 3 $access_token = $acc_token['oauth_token']; $access_token_secret = $acc_token['oauth_token_secret']; $oauth = new OAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI); $oauth->setToken($access_token, $access_token_secret); try { $data = $oauth->fetch("http://openapi.etsy.com/{$v2_path}/private/users/__SELF__"); $json = $oauth->getLastResponse(); print "results for logged in user info\n"; print_r(json_decode($json, true)); } catch (OAuthException $e) { error_log($e->getMessage()); error_log(print_r($oauth->getLastResponse(), true)); error_log(print_r($oauth->getLastResponseInfo(), true)); exit; }
<?php require "config.inc.php"; try { $o = new OAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); $access_token_info = unserialize(file_get_contents(OAUTH_TMP_DIR . "/access_token_resp")); $o->setToken($access_token_info["oauth_token"], $access_token_info["oauth_token_secret"]); /* the following bit refreshes the token using the session handle (http://wiki.oauth.net/ScalableOAuth) ... you don't need it unless your original access token is invalid but you'll need to audit this yourself, for example sakes we'll pretend it has expired. */ if (!empty($access_token_info["oauth_session_handle"])) { $o->setAuthType(OAUTH_AUTH_TYPE_URI); $access_token_info = $o->getAccessToken("https://api.login.yahoo.com/oauth/v2/get_token", $access_token_info["oauth_session_handle"]); $o->setToken($access_token_info["oauth_token"], $access_token_info["oauth_token_secret"]); $o->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION); file_put_contents(OAUTH_TMP_DIR . "/access_token_resp", serialize($access_token_info)); } /* done refreshing access token, time to do some fetching! */ $query = rawurlencode("select * from social.profile where guid=me"); $o->fetch("http://query.yahooapis.com/v1/yql?q={$query}&format=xml"); $response_info = $o->getLastResponseInfo(); header("Content-Type: {$response_info["content_type"]}"); echo $o->getLastResponse(); } catch (OAuthException $E) { echo "Exception caught!\n"; echo "Response: " . $E->lastResponse . "\n"; }
/** * Make custom call to any API endpoint, signed with consumer_key only (on behalf of CLIENT) * * @param string $url Endpoint url after '.../1/' * @param array $parameters Request parameters * @param string $method (OAUTH_HTTP_METHOD_GET, OAUTH_HTTP_METHOD_POST, OAUTH_HTTP_METHOD_PUT, OAUTH_HTTP_METHOD_DELETE) * @param array $userHeaders Additional custom headers * @return FitBitResponse */ public function client_customCall($url, $parameters, $method, $userHeaders = array()) { $OAuthConsumer = new OAuth($this->consumer_key, $this->consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_AUTHORIZATION); if ($debug) { $OAuthConsumer->enableDebug(); } $headers = $this->getHeaders(); $headers = array_merge($headers, $userHeaders); try { $OAuthConsumer->fetch($this->baseApiUrl . $url, $parameters, $method, $headers); } catch (Exception $E) { } $response = $OAuthConsumer->getLastResponse(); $responseInfo = $OAuthConsumer->getLastResponseInfo(); $this->clientDebug = print_r($OAuthConsumer->debugInfo, true); return new FitBitResponse($response, $responseInfo['http_code']); }
$OAuth = new OAuth($consumerKey, $consumerSecret); $OAuth->enableDebug(); // SSL CA Signed if ($self_signed) { $OAuth->disableSSLChecks(); } $tokenInfo = $OAuth->getRequestToken($requestURL, $callbackURL); } catch (Exception $E) { echo '<h1>There was an error getting the Request Token</h1>'; echo '<pre>'; echo "Message:\n"; print_r($E->getMessage()); echo "\n\nLast Response:\n"; print_r($OAuth->getLastResponse()); echo "\n\nLast Response Info:\n"; print_r($OAuth->getLastResponseInfo()); echo "\n\nDebug Info:\n"; print_r($OAuth->debugInfo); // get info about headers echo '</pre>'; } // Check whether Return is empty or not if (empty($tokenInfo['oauth_token_secret']) || empty($tokenInfo['oauth_token'])) { echo "<pre>Token Info:\n"; print_r($tokenInfo); echo '</pre>'; exit; } $_SESSION['oauth_token_secret'] = $tokenInfo['oauth_token_secret']; $location = $authorizeURL . '?oauth_token=' . $tokenInfo['oauth_token']; //header('Location: ' . $location);
private function requestAccessToken($oauth_token) { // URL $accessURL = "https://{$this->server}/oauth/access"; // Get Access Token Flow session_start(); try { $OAuth = new \OAuth($this->consumerKey, $this->consumerSecret); if ($this->self_signed) { $OAuth->disableSSLChecks(); } $OAuth->setToken($oauth_token, $_SESSION['oauth_token_secret']); $OAuth->enableDebug(); $tokenInfo = $OAuth->getAccessToken($accessURL); $response_body = $OAuth->getLastResponse(); $response = $OAuth->getLastResponseInfo(); $debug = $OAuth->debugInfo; // Open and decode the file // $data = json_decode(file_get_contents('keys.json')); // // if (!isset($data->consumer) || !isset($data->access)) { // die("Someone has deleted the consumer field during the OAuth handshake."); // } // // // Setting new data // $data->access->token = $tokenInfo['oauth_token']; // $data->access->secret = $tokenInfo['oauth_token_secret']; // // // encode // $new_data = json_encode($data); // // // write contents to the file // $handle = fopen('keys.json', 'w'); // fwrite($handle, $new_data); // fclose($handle); $access = array("token" => $tokenInfo['oauth_token'], "secret" => $tokenInfo['oauth_token_secret']); } catch (Exception $E) { echo "<pre>OAuth ERROR MESSAGE:\n"; echo $E->getMessage(); echo "\nRESPONSE:\n"; var_dump($OAuth->getLastResponse()); echo "\nRESPONSE INFO:\n"; var_dump($OAuth->getLastResponseInfo()); echo '</pre>'; } return $access; }