当前位置: 首页>>代码示例>>PHP>>正文


PHP OAuth::getLastResponseInfo方法代码示例

本文整理汇总了PHP中OAuth::getLastResponseInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuth::getLastResponseInfo方法的具体用法?PHP OAuth::getLastResponseInfo怎么用?PHP OAuth::getLastResponseInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OAuth的用法示例。


在下文中一共展示了OAuth::getLastResponseInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResponse

 /**
  * @return Response
  */
 protected function getResponse()
 {
     $responseInfo = $this->oAuthClient->getLastResponseInfo();
     $response = Response::createFromRaw($responseInfo['headers_recv']);
     $response->appendContent($this->oAuthClient->getLastResponse());
     return $response;
 }
开发者ID:raumkreuzer,项目名称:SurfCaptain,代码行数:10,代码来源:OAuthRequest.php

示例2: makeRequestAndPrintResponse

 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();
 }
开发者ID:JulianVolodia,项目名称:jquery-usos,代码行数:20,代码来源:usosapiProxy.php

示例3: SendTweet

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;
}
开发者ID:erorus,项目名称:newsstand,代码行数:40,代码来源:sendwowtokentweet.php

示例4: OAuth

<?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";
}
开发者ID:pwned,项目名称:Pwned-OAuth-PHP,代码行数:20,代码来源:status.php

示例5: flow

 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));
             }
         }
     }
 }
开发者ID:nicolargo,项目名称:frontend,代码行数:50,代码来源:OAuthController.php

示例6: array

 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;
 }
开发者ID:hubgit,项目名称:libapi,代码行数:80,代码来源:API.php

示例7: catch

         $_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"];
开发者ID:nanqiu,项目名称:PhpOperaLink,代码行数:31,代码来源:index.php

示例8: die

    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;
开发者ID:noxfate,项目名称:gtc,代码行数:31,代码来源:api_call.php

示例9: OAuth

<?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);
开发者ID:navanjr,项目名称:OAuth-consumer,代码行数:28,代码来源:get_request_token.php

示例10: array

             // $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') {
开发者ID:ram-1501,项目名称:rs,代码行数:31,代码来源:aaa.php

示例11: SendTweet

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;
}
开发者ID:erorus,项目名称:newsstand,代码行数:74,代码来源:wowtoken.php

示例12: header

    $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);
}
开发者ID:khairulazami,项目名称:learn-magento-api,代码行数:31,代码来源:rest.php

示例13: catch

$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;
}
开发者ID:jgoulah,项目名称:etsyapi-php-cli,代码行数:31,代码来源:oauth_flow.php

示例14: OAuth

<?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";
}
开发者ID:checkout51,项目名称:pecl-web_services-oauth,代码行数:25,代码来源:exec_yql_refresh_token.php

示例15: client_customCall

 /**
  * 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']);
 }
开发者ID:djchen,项目名称:fitbitphp,代码行数:26,代码来源:fitbitphp.php


注:本文中的OAuth::getLastResponseInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。