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


PHP OAuthRequester::requestAccessToken方法代码示例

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


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

示例1: douban_callback

function douban_callback()
{
    OAuthRequester::requestAccessToken(DOUBAN_KEY, $_SESSION['oauth_token'], 0, 'POST', $options = array('oauth_verifier' => $_SESSION['oauth_token']));
    $req = new OAuthRequester('http://api.douban.com/people/' . urlencode('@me'), 'get');
    $res = $req->doRequest();
    $user_data = new SimpleXMLElement($res['body']);
    $uid = array_pop(explode('/', $user_data->id));
    $auth_type = 'douban';
    $auth = R::findOne('oauth', "uid=? AND type=?", array($uid, $auth_type));
    if (!$auth) {
        $auth = R::dispense('oauth');
        $auth->uid = $uid;
        $auth->type = $auth_type;
        $encrypt_key = rand(100000, 999999);
        $auth->secret = $encrypt_key;
    } else {
        $encrypt_key = $auth->secret;
    }
    $cookie_str = sha1(implode('', array($uid, $auth_type, $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $encrypt_key)));
    $expire = time() + 3600 * 24 * 365;
    setcookie('s', $cookie_str, $expire);
    setcookie('auth_type', $auth_type, $expire);
    setcookie('uid', $uid, $expire);
    $auth->setMeta('buildcommand.unique', array(array('uid', 'type')));
    $auth->setMeta('buildcommand.indexes', array('uid' => 'uid'));
    R::store($auth);
}
开发者ID:reusee,项目名称:defphp,代码行数:27,代码来源:douban_oauth.php

示例2: getResponseAPI

function getResponseAPI($userIdZyncro, $sessionid, $serviceAPI)
{
    // Init the OAuthStore
    $options = array('consumer_key' => CONSUMER_KEY, 'consumer_secret' => CONSUMER_SECRET, 'server_uri' => OAUTH_HOST, 'request_token_uri' => REQUEST_TOKEN_URL, 'signature_methods' => array('HMAC-SHA1'), 'authorize_uri' => AUTHORIZE_URL, 'access_token_uri' => ACCESS_TOKEN_URL);
    // Note: do not use "Session" storage in production. Prefer a database
    // storage, such as MySQL.
    OAuthStore::instance("Session", $options);
    try {
        // get a request token
        $getRequestTokenParams = array();
        $tokenResultParams = OAuthRequester::requestRequestToken(CONSUMER_KEY, 0, $getRequestTokenParams, 'GET');
        // get an access token
        $oauthToken = $tokenResultParams['token'];
        $getAccessTokenParams = array('oauth_verifier' => $sessionid);
        OAuthRequester::requestAccessToken(CONSUMER_KEY, $oauthToken, 0, 'POST', $getAccessTokenParams);
        // make the request.
        $urlRequest = OAUTH_HOST . $serviceAPI;
        $request = new OAuthRequester($urlRequest, 'GET');
        $result = $request->doRequest(0);
        if ($result['code'] == 200) {
            return $result['body'];
        }
    } catch (OAuthException2 $e) {
    }
}
开发者ID:nachoruiz29,项目名称:javascript-api-samples,代码行数:25,代码来源:zyncro_api_functions.php

示例3: authorize

 public static function authorize($consumer_key, $consumer_secret, $oauth_token, $verifier, $store = "MySQL", $user_id = 1, $extra_options = array())
 {
     //Obtain an access token. This token can be reused until it expires.
     OAuthClient::storeInstance(OAuthClient::merge_options($consumer_key, $consumer_secret, $extra_options), $store);
     try {
         OAuthRequester::requestAccessToken($consumer_key, $oauth_token, $user_id, 'POST', array('oauth_token' => $oauth_token, 'oauth_verifier' => $verifier));
     } catch (OAuthException2 $e) {
         var_dump($e);
         return;
     }
 }
开发者ID:maza23,项目名称:fusion-tables-client-php,代码行数:11,代码来源:oauth.php

示例4: exchangeapitokenAction

 public function exchangeapitokenAction()
 {
     $service = new Ml_Model_Service();
     $this->_helper->loadOauthstore->setinstance();
     $userId = $service->getInput("User ID");
     $consumerKey = $service->getInput("Consumer key");
     $oauthToken = $service->getInput("Oauth token");
     require EXTERNAL_LIBRARY_PATH . '/oauth-php/library/OAuthRequester.php';
     try {
         OAuthRequester::requestAccessToken($consumerKey, $oauthToken, $userId);
         echo "Request token exchanged for access token.\n";
     } catch (OAuthException $e) {
         // Something wrong with the oauth_token.
         // Could be:
         // 1. Was already ok
         // 2. We were not authorized
         throw $e;
     }
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:19,代码来源:TestController.php

示例5: array

//- Prepare the PHP OAuth for consuming our Oxygen service
$options = array('consumer_key' => ConsumerKey, 'consumer_secret' => ConsumerSecret, 'server_uri' => BaseUrl, 'request_token_uri' => BaseUrl . 'OAuth/RequestToken', 'authorize_uri' => BaseUrl . 'OAuth/Authorize', 'access_token_uri' => BaseUrl . 'OAuth/AccessToken');
OAuthStore::instance('Session', $options);
$fname = realpath(dirname(__FILE__)) . '/token.txt';
$token = unserialize(file_get_contents($fname));
unlink($fname);
//- To disable the SSL check to avoid an exception with invalidate certificate on the server,
//- use the cURL CURLOPT_SSL_VERIFYPEER option and set it to false.
//- 3rd leg: Get the 'access token' and session
$access = '';
try {
    //- The following line is for reference only, the call to OAuthRequester::requestRequestToken() included that step. But you may need
    //- to call that line with the correct parameters in you run that 'leg' in a different PHP session.
    OAuthStore::instance()->addServerToken(ConsumerKey, 'request', $token['oauth_token'], $token['oauth_token_secret'], 0, array());
    //- $access will contain the server response in case you modified the Google library like documented above
    $access = OAuthRequester::requestAccessToken(ConsumerKey, $token['oauth_token'], 0, 'POST', $options, array(CURLOPT_SSL_VERIFYPEER => 0));
    //- If you did not modify OAuthRequester::requestAccessToken() function as documented above, do this instead
    // $access =array (
    // 	'oauth_token' => OAuthStore::instance ()->getSecretsForSignature ('', 0) ['token'],
    // 	'oauth_token_secret' => OAuthStore::instance ()->getSecretsForSignature ('', 0) ['token_secret'],
    // ) ;
    /*
    define ('OAUTH_HOST', 'http://' . $_SERVER ['SERVER_NAME']) ;
    $request =new OAuthRequester (OAUTH_HOST . $_SERVER ['PHP_SELF'], 'POST', $token) ;
        $access =$request->doRequest (0) ;
    */
    //- In this sample, we save the token to a file, and use it in the Refresh example
    $fname = realpath(dirname(__FILE__)) . '/access_token.txt';
    file_put_contents($fname, serialize($access));
} catch (Exception $e) {
    echo "OAuth/AccessToken\n", 'Caught exception: ', $e->getMessage(), "\n";
开发者ID:rickymf4,项目名称:AutodeskOAuthSamples,代码行数:31,代码来源:AdskOAuthWebNoExtLeg3.php

示例6: header

         $tokenResultParams = OAuthRequester::requestRequestToken(SFDOCTOR_CONSUMER_KEY, 0, $getAuthTokenParams);
         //  redirect to the 65doctor authorization page, they will redirect back
         header("Location: " . SFDOCTOR_AUTHORIZE_URL . "?oauth_token=" . $tokenResultParams['token'] . $signature);
     } else {
         echo '<pre>';
         print_r('Missing username or password.');
         echo '</pre>';
         exit;
     }
 } else {
     //  STEP 2:  Get an access token
     $oauthToken = $_GET["oauth_token"];
     // echo "oauth_verifier = '" . $oauthVerifier . "'<br/>";
     $tokenResultParams = $_GET;
     try {
         OAuthRequester::requestAccessToken(SFDOCTOR_CONSUMER_KEY, $oauthToken, 0, 'POST', $_GET);
     } catch (OAuthException2 $e) {
         echo '<pre>';
         print_r($e);
         echo '</pre>';
         // Something wrong with the oauth_token.
         // Could be:
         // 1. Was already ok
         // 2. We were not authorized
         return;
     }
     $_SESSION['SFDOCTOR_TOKEN'] = $tokenResultParams;
     // make the resource owner requestrequest.
     //		$request = new OAuthRequester($uriProfile, 'GET', $tokenResultParams);
     //		$result = $request->doRequest(0);
     //		if ($result['code'] == 200) {
开发者ID:jasonhai,项目名称:onehome,代码行数:31,代码来源:_login.php

示例7: array

OAuthStore::instance("Session", $options);
try {
    //  STEP 1:  If we do not have an OAuth token yet, go get one
    if (empty($_GET["oauth_token"])) {
        $getAuthTokenParams = array('scope' => 'http://docs.google.com/feeds/', 'xoauth_displayname' => 'Oauth test', 'oauth_callback' => 'XXXXXXXXXXX');
        // get a request token
        $tokenResultParams = OAuthRequester::requestRequestToken(GOOGLE_CONSUMER_KEY, 0, $getAuthTokenParams);
        //  redirect to the google authorization page, they will redirect back
        header("Location: " . GOOGLE_AUTHORIZE_URL . "?btmpl=mobile&oauth_token=" . $tokenResultParams['token']);
    } else {
        //  STEP 2:  Get an access token
        $oauthToken = $_GET["oauth_token"];
        // echo "oauth_verifier = '" . $oauthVerifier . "'<br/>";
        $tokenResultParams = $_GET;
        try {
            OAuthRequester::requestAccessToken(GOOGLE_CONSUMER_KEY, $oauthToken, 0, 'POST', $_GET);
        } catch (OAuthException2 $e) {
            var_dump($e);
            // Something wrong with the oauth_token.
            // Could be:
            // 1. Was already ok
            // 2. We were not authorized
            return;
        }
        // make the docs requestrequest.
        $request = new OAuthRequester("http://docs.google.com/feeds/documents/private/full", 'GET', $tokenResultParams);
        $result = $request->doRequest(0);
        if ($result['code'] == 200) {
            var_dump($result['body']);
        } else {
            echo 'Error';
开发者ID:cybKIRA,项目名称:oauth-php,代码行数:31,代码来源:googledocs.php

示例8: getAccessToken

 public function getAccessToken($oauth_user_id)
 {
     //  STEP 2:  Get an access token
     $oauthToken = $_GET["oauth_token"];
     // echo "oauth_verifier = '" . $oauthVerifier . "'<br/>";
     $tokenResultParams = $_GET;
     OAuthRequester::requestAccessToken($this->oAuthConsumerKey, $oauthToken, $oauth_user_id, 'POST', $_GET);
 }
开发者ID:russelldavis,项目名称:UserBase,代码行数:8,代码来源:OAuthModule.php

示例9: array

// storage, such as MySQL.
OAuthStore::instance("Session", $options);
try {
    //  STEP 1:  If we do not have an OAuth token yet, go get one
    if (empty($_GET["oauth_verifier"])) {
        $getAuthTokenParams = array('oauth_callback' => 'oob');
        $options = array('oauth_as_header' => false);
        // get a request token
        $tokenResultParams = OAuthRequester::requestRequestToken(OPERA_CONSUMER_KEY, 0, $getAuthTokenParams, 'POST', $options);
        $_SESSION['oauth_token'] = $tokenResultParams['token'];
        //  redirect to the opera authorization page, they will redirect back
        header("Location: " . OPERA_AUTHORIZE_URL . "?oauth_token=" . $tokenResultParams['token']);
    } else {
        //  STEP 2:  Get an access token
        try {
            OAuthRequester::requestAccessToken(OPERA_CONSUMER_KEY, $_SESSION['oauth_token'], 0, 'POST', $options = array('oauth_verifier' => $_GET['oauth_verifier']));
        } catch (OAuthException2 $e) {
            var_dump($e);
            // Something wrong with the oauth_token.
            // Could be:
            // 1. Was already ok
            // 2. We were not authorized
            return;
        }
        // make the docs requestrequest.
        $request = new OAuthRequester("http://my.opera.com/community/api/users/status.pl", 'GET');
        $result = $request->doRequest(0, array(CURLOPT_HTTPHEADER => array('Accept: application/json')));
        if ($result['code'] == 200) {
            var_dump($result['body']);
        } else {
            echo 'Error';
开发者ID:khosro,项目名称:oauth-php,代码行数:31,代码来源:opera.php

示例10: define

<?php

require_once '../../vendor/autoload.php';
define('OAUTH_HOST', 'http://' . $_SERVER['SERVER_NAME']);
$id = 1;
// Init the OAuthStore
$options = array('consumer_key' => '<MYCONSUMERKEY>', 'consumer_secret' => '<MYCONSUMERSECRET>', 'server_uri' => OAUTH_HOST, 'request_token_uri' => OAUTH_HOST . '/request_token.php', 'authorize_uri' => OAUTH_HOST . '/login.php', 'access_token_uri' => OAUTH_HOST . '/access_token.php');
OAuthStore::instance('Session', $options);
if (empty($_GET['oauth_token'])) {
    // get a request token
    $tokenResultParams = OAuthRequester::requestRequestToken($options['consumer_key'], $id);
    header('Location: ' . $options['authorize_uri'] . '?oauth_token=' . $tokenResultParams['token'] . '&oauth_callback=' . urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']));
} else {
    // get an access token
    $oauthToken = $_GET['oauth_token'];
    $tokenResultParams = $_GET;
    OAuthRequester::requestAccessToken($options['consumer_key'], $tokenResultParams['oauth_token'], $id, 'POST', $_GET);
    $request = new OAuthRequester(OAUTH_HOST . '/test_request.php', 'GET', $tokenResultParams);
    $result = $request->doRequest(0);
    if ($result['code'] == 200) {
        var_dump($result['body']);
    } else {
        echo 'Error';
    }
}
开发者ID:jasarjasu786,项目名称:CreatingAPHPOAuthServer,代码行数:25,代码来源:oauth_test.php

示例11: _setupAccessToken

 /**
  * Get access token
  *
  * @param	string $verifier OAuth verifier, got after authorization
  * @access	protected
  * @return	array
  */
 protected function _setupAccessToken($verifier)
 {
     ApiDebug::p('requesting access token');
     $accessTokenInfo = array();
     $oauth = $this->_getOAuthInstance();
     \OAuthRequester::requestAccessToken(self::$_apiKey, self::$_requestToken, 0, 'POST', array('oauth_verifier' => $verifier), self::_getCurlOptions());
     $accessTokenInfo['oauth_token'] = $_SESSION['oauth_' . self::$_apiKey]['token'];
     $accessTokenInfo['oauth_token_secret'] = $_SESSION['oauth_' . self::$_apiKey]['token_secret'];
     ApiDebug::p('got access token info', $accessTokenInfo);
     self::$_accessToken = $accessTokenInfo['oauth_token'];
     self::$_accessSecret = $accessTokenInfo['oauth_token_secret'];
     return $accessTokenInfo;
 }
开发者ID:e2e4gu,项目名称:php-upwork,代码行数:20,代码来源:OAuthPHPLib.php

示例12: header

    $queryParams = $request->getQueryString(false);
    header('Location: ' . $requestTokenUrl . '?' . $queryParams);
} elseif ($_GET['oauth_token']) {
    /*
     * Login callback. After the user logs in, they are redirected back to this
     * page with the oauth_token field specified. We then can use that token (as
     * well as some other request params) to get an access token to use
     *
     * Once the access token is obtained, we immediately redirect to the main
     * logged-in page to allow the user to make requests.
     */
    $oauthToken = $_GET['oauth_token'];
    $oauthTokenSecret = $_GET['oauth_token_secret'];
    $store->addServerToken($consumerKey, 'request', $oauthToken, $oauthTokenSecret, 0);
    $accessTokenParams = array('oauth_verifier' => $_GET['oauth_verifier'], 'oauth_callback' => $loginCallback);
    OAuthRequester::requestAccessToken($consumerKey, $oauthToken, 0, 'POST', $accessTokenParams);
    header('Location: ka_client.php?logged_in=1');
} elseif ($_GET['logged_in']) {
    /*
     * Main logged-in page. Display a form for typing in a query, and execute a
     * query and display its results if one was specified.
     */
    $defaultQuery = $_GET['query'];
    if (!$defaultQuery) {
        $defaultQuery = '/api/v1/user';
    }
    ?>
    Make a GET request:
    <form>
        <input type="hidden" name="logged_in" value=1>
        <input type="text" name="query" value="<?php 
开发者ID:hblumberg,项目名称:khan-api,代码行数:31,代码来源:ka_client.php

示例13: finishAuthenticate

 /**
  * finishAuthenticate - Should be invoked from callback uri passed to authorize
  *
  * @param string $consumerKey Access key 
  * @param integer $userId A user identificator
  * @param string $oauthToken Token got in call to authorize
  * @return void
  */
 public function finishAuthenticate($consumerKey, $userId, $oauthToken)
 {
     OAuthRequester::requestAccessToken($consumerKey, $oauthToken, $userId);
 }
开发者ID:voota,项目名称:voota,代码行数:12,代码来源:voota_api.class.php

示例14: kaixin001

 /**
  * 绑定开心网.
  * @param string $username
  * @param string $password
  * @param boolean $follow
  */
 private function kaixin001($username, $password, $follow)
 {
     set_time_limit(120);
     require_once Kohana::find_file('vendor', 'oauth/OAuthRequester');
     $okey = Kohana::config('uap.oauth');
     define("MOMO_CONSUMER_KEY", $okey['kaixin001.com']['WB_AKEY']);
     define("MOMO_CONSUMER_SECRET", $okey['kaixin001.com']['WB_SKEY']);
     define("MOMO_OAUTH_HOST", "http://api.kaixin001.com");
     define("MOMO_REQUEST_TOKEN_URL", MOMO_OAUTH_HOST . "/oauth/request_token");
     define("MOMO_AUTHORIZE_URL", MOMO_OAUTH_HOST . "/oauth/authorize");
     define("MOMO_ACCESS_TOKEN_URL", MOMO_OAUTH_HOST . "/oauth/access_token");
     define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : realpath($_ENV["TMP"]));
     $store = OAuthStore::instance('MySQL');
     $usr_id = $this->user_id;
     try {
         try {
             $store->getServer(MOMO_CONSUMER_KEY, $usr_id);
         } catch (OAuthException2 $e) {
             //初始化
             $server = array('consumer_key' => MOMO_CONSUMER_KEY, 'consumer_secret' => MOMO_CONSUMER_SECRET, 'server_uri' => MOMO_OAUTH_HOST, 'signature_methods' => array('HMAC-SHA1', 'PLAINTEXT'), 'request_token_uri' => MOMO_REQUEST_TOKEN_URL, 'authorize_uri' => MOMO_AUTHORIZE_URL, 'access_token_uri' => MOMO_ACCESS_TOKEN_URL);
             //$store->deleteServer(MOMO_CONSUMER_KEY, $usr_id);
             $consumer_key = $store->updateServer($server, $usr_id);
         }
         $tokenResultParams = OAuthRequester::requestRequestToken(MOMO_CONSUMER_KEY, $usr_id, array("scope" => "basic create_records"), "GET");
         usleep(5);
         //STEP 1:  If we do not have an OAuth token yet, go get one
         $Params = array("email" => $username, "password" => $password, "callback" => urlencode('http://api.kaixin001.com/oauth/authorize?oauth_token=' . $tokenResultParams['token'] . '&oauth_callback=' . urlencode(url::site("bind/confirm")) . '&from=&oauth_client=1'), "appkey" => MOMO_CONSUMER_KEY, "fromclient" => "", "return" => "", "login" => "登陆");
         $query = '';
         foreach ($Params as $key => $value) {
             $query .= $key . '=' . $value . '&';
         }
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
         if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
             $cip = $_SERVER["HTTP_CLIENT_IP"];
         } else {
             if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
                 $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
             } else {
                 if (!empty($_SERVER["REMOTE_ADDR"])) {
                     $cip = $_SERVER["REMOTE_ADDR"];
                 } else {
                     //找不到默認為momo服務器ip
                     $cip = "58.22.103.199";
                 }
             }
         }
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', "CLIENT-IP: {$cip}", "X-FORWARDED-FOR: {$cip}"));
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.10 (maverick) Firefox/3');
         curl_setopt($ch, CURLOPT_URL, "http://wap.kaixin001.com/auth/login.php?isoauth=1");
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HEADER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
         //curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); //是否抓取302跳转后的
         $txt = curl_exec($ch);
         curl_close($ch);
         preg_match('@Location:(.*)@i', $txt, $matches);
         if (!isset($matches[1]) || stripos($matches[1], '/oauth/authorize') === FALSE) {
             $this->send_response(407, null, "用户名或密码错误");
             return null;
         }
         $Params = array("loginnewsfeed" => 1, "oauth_token" => $tokenResultParams['token'], "oauth_callback" => "", "appid" => $okey['kaixin001.com']['APP_ID'], "oauth_client" => 1, "accept" => "允许");
         $query = '';
         foreach ($Params as $key => $value) {
             $query .= $key . '=' . $value . '&';
         }
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', "CLIENT-IP: {$cip}", "X-FORWARDED-FOR: {$cip}"));
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.10 (maverick) Firefox/3');
         curl_setopt($ch, CURLOPT_URL, trim($matches[1]));
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HEADER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
         $txt = curl_exec($ch);
         curl_close($ch);
         preg_match('@你获取到的授权码是:<b>(\\w+)</b>@i', $txt, $matches);
         if (!isset($matches[1])) {
             $this->send_response(500, null, "oauth_verifier未取到");
             return null;
         }
         $oauth_verifier = $matches[1];
         usleep(5);
         //STEP 2:  Get an access token
         try {
             $access_token = OAuthRequester::requestAccessToken(MOMO_CONSUMER_KEY, $tokenResultParams['token'], $usr_id, 'POST', array("oauth_verifier" => $oauth_verifier));
             try {
                 //取得个人信息
                 usleep(5);
                 $request = new OAuthRequester("http://api.kaixin001.com/users/me.json", 'GET');
                 $result = $request->doRequest($this->user_id);
                 if ($result['code'] != 200) {
//.........这里部分代码省略.........
开发者ID:momoim,项目名称:momo-api,代码行数:101,代码来源:bind.php

示例15: array

<?php

/*
 * Here we're going to use the token returned from splitwise, and store the access token in the mysql database.
 * 
 */
require "oauth/OAuthStore.php";
require "oauth/OAuthRequester.php";
require "config.php";
$oauth_token = $_GET['oauth_token'];
$oauth_verifyer = $_GET['oauth_verifier'];
try {
    $data = OAuthRequester::requestAccessToken($key, $oauth_token, $user_id, "POST", array('oauth_verifier' => $oauth_verifyer));
    echo "<pre>" . print_r($data, true) . "\n";
    echo "request ok";
} catch (OAuthException2 $e) {
    echo "<pre>";
    print_r($e);
    // Something wrong with the oauth_token.
    // Could be:
    // 1. Was already ok
    // 2. We were not authorized
}
开发者ID:shellyjindal10,项目名称:splitwise-api-example,代码行数:23,代码来源:process_access_token.php


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