當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OAuth::getAuthorizeURL方法代碼示例

本文整理匯總了PHP中OAuth::getAuthorizeURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuth::getAuthorizeURL方法的具體用法?PHP OAuth::getAuthorizeURL怎麽用?PHP OAuth::getAuthorizeURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OAuth的用法示例。


在下文中一共展示了OAuth::getAuthorizeURL方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ilost_get_fanauthorize

function ilost_get_fanauthorize()
{
    $o = new OAuth(fan_akey, fan_skey);
    $keys = $o->getRequestToken();
    $aurl = $o->getAuthorizeURL($keys['oauth_token'], false, fan_callback);
    $_SESSION['temp'] = $keys;
    return $aurl;
}
開發者ID:xuui,項目名稱:iLost,代碼行數:8,代碼來源:fanfou.php

示例2: index

 /**
  * 登陸
  * @param type $callbackurl 囘調URL
  */
 public function index($callback)
 {
     OAuth::init($this->client_id, $this->client_secret);
     Tencent::$debug = $this->debug;
     header('Content-Type: text/html; charset=utf-8');
     $url = OAuth::getAuthorizeURL($callback);
     header('Location: ' . $url);
     exit;
 }
開發者ID:pbchen,項目名稱:thirdLoginAPI,代碼行數:13,代碼來源:YafQQweibo.php

示例3: get_bind_api_url

 public function get_bind_api_url()
 {
     es_session::start();
     require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php';
     OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']);
     if ($this->api['config']['app_url'] == "") {
         $app_url = get_domain() . APP_ROOT . "/api_callback.php?c=Tencent";
     } else {
         $app_url = $this->api['config']['app_url'];
     }
     $aurl = OAuth::getAuthorizeURL($app_url);
     return $aurl;
 }
開發者ID:xcdxcd,項目名稱:zhongchou,代碼行數:13,代碼來源:Tencent_api.php

示例4: get_bind_api_url

 public function get_bind_api_url()
 {
     es_session::start();
     require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php';
     OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']);
     if ($this->api['config']['app_url'] == "") {
         $app_url = get_domain() . APP_ROOT . "/api_callback.php?c=Tencent";
     } else {
         $app_url = $this->api['config']['app_url'];
     }
     $aurl = OAuth::getAuthorizeURL($app_url);
     es_session::set("is_bind", 1);
     $str = "<a href='" . $aurl . "' title='" . $this->api['name'] . "'><img src='" . $this->api['bicon'] . "' alt='" . $this->api['name'] . "' /></a>&nbsp;";
     return $str;
 }
開發者ID:dalinhuang,項目名稱:zsh_business,代碼行數:15,代碼來源:Tencent_api.php

示例5: get_bind_api_url_arr

 /**
  * 返回騰訊綁定數組信息
  * @return array("class","name","bicon",url);
  */
 public function get_bind_api_url_arr()
 {
     require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php';
     OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']);
     if ($this->api['config']['app_url'] == "") {
         $app_url = SITE_DOMAIN . APP_ROOT . "/api_callback.php?c=Tencent";
     } else {
         $app_url = $this->api['config']['app_url'];
     }
     $aurl = OAuth::getAuthorizeURL($app_url);
     es_session::set("is_bind", 1);
     $data['class'] = 'tencent';
     $data['name'] = $this->api['name'];
     $data['bicon'] = $this->api['bicon'];
     $data['url'] = $aurl;
     return $data;
 }
開發者ID:macall,項目名稱:jsd,代碼行數:21,代碼來源:Tencent_api.php

示例6: oauthRoute

 public static function oauthRoute($type)
 {
     global $kekezu, $weibo_list;
     require S_ROOT . "include/oauth/config.php";
     if ($type === 'sina') {
         require S_ROOT . "include/oauth/sina/saetv2.ex.class.php";
         $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
         $code_url = $o->getAuthorizeURL(WB_CALLBACK_URL);
     }
     if ($type === 'qq') {
         require S_ROOT . "include/oauth/qq/qqConnectAPI.php";
         $qqConnectAPI = new QC();
         $qqConnectAPI->qq_login();
         die;
     }
     if ($type === 'ten') {
         require S_ROOT . "include/oauth/ten/Tencent.php";
         OAuth::init(TEN_AKEY, TEN_SKEY);
         Tencent::$debug = false;
         $code_url = OAuth::getAuthorizeURL(TEN_CALLBACK_URL);
     }
     if ($type === 'renren') {
         require S_ROOT . "include/oauth/renren/rennclient/RennClient.php";
         $rennClient = new RennClient(APP_KEY, APP_SECRET);
         $state = uniqid('renren_', true);
         $_SESSION['renren_state'] = $state;
         $code_url = $rennClient->getAuthorizeURL(CALLBACK_URL, 'code', $state);
     }
     if ($type === 'douban') {
         require S_ROOT . 'include/oauth/douban/douban.php';
         $douBan = new doubanPHP(DB_APIKEY, DB_SECRET);
         $code_url = $douBan->login_url(DB_CALLBACK_URL, DB_SCOPE);
     }
     header("location:" . $code_url);
 }
開發者ID:huangbinzd,項目名稱:kppwGit,代碼行數:35,代碼來源:UserCenter.php

示例7: actionIndex

 public function actionIndex()
 {
     $code_url = \OAuth::getAuthorizeURL($this->url);
     header("location:{$code_url}");
     exit;
 }
開發者ID:rocketyang,項目名稱:mincms,代碼行數:6,代碼來源:TqController.php

示例8: header

            //驗證授權
            $r = OAuth::checkOAuthValid();
            if ($r) {
                header('Location: ' . $callback);
                //刷新頁麵
            } else {
                exit('<h3>授權失敗,請重試</h3>');
            }
        } else {
            exit($r);
        }
    } else {
        //獲取授權code
        if ($_GET['openid'] && $_GET['openkey']) {
            //應用頻道
            $_SESSION['t_openid'] = $_GET['openid'];
            $_SESSION['t_openkey'] = $_GET['openkey'];
            //驗證授權
            $r = OAuth::checkOAuthValid();
            if ($r) {
                header('Location: ' . $callback);
                //刷新頁麵
            } else {
                exit('<h3>授權失敗,請重試</h3>');
            }
        } else {
            $url = OAuth::getAuthorizeURL($callback);
            header('Location: ' . $url);
        }
    }
}
開發者ID:meathill-freelance,項目名稱:digi.tencent.2012-wb,代碼行數:31,代碼來源:app.php

示例9: checkUser

 public function checkUser($do)
 {
     // dump($_REQUEST);
     // dump($do);
     // exit;
     OAuth::init(QQ_KEY, QQ_SECRET);
     $callback = $this->getCallback('qq', $do);
     if ($_REQUEST['code']) {
         $code = $_REQUEST['code'];
         $openid = $_REQUEST['openid'];
         $openkey = $_REQUEST['openkey'];
         //獲取授權token
         $url = OAuth::getAccessToken($code, $callback);
         $r = Http::request($url);
         parse_str($r, $out);
         //存儲授權數據
         if ($out['access_token']) {
             $_SESSION['t_access_token'] = $out['access_token'];
             $_SESSION['t_refresh_token'] = $out['refresh_token'];
             $_SESSION['t_expire_in'] = $out['expires_in'];
             $_SESSION['t_code'] = $code;
             $_SESSION['t_openid'] = $openid;
             $_SESSION['t_openkey'] = $openkey;
             $_SESSION['qq']['access_token'] = $out['access_token'];
             $_SESSION['qq']['refresh_token'] = $out['refresh_token'];
             $_SESSION['open_platform_type'] = 'qq';
             //驗證授權
             $r = OAuth::checkOAuthValid();
             if ($r) {
                 // header('Location: ' . $callback);//刷新頁麵
                 return true;
             } else {
                 // exit('<h3>授權失敗,請重試</h3>');
                 return false;
             }
         } else {
             exit($r);
         }
     } else {
         //獲取授權code
         if ($_GET['openid'] && $_GET['openkey']) {
             //應用頻道
             $_SESSION['t_openid'] = $_GET['openid'];
             $_SESSION['t_openkey'] = $_GET['openkey'];
             //驗證授權
             $r = OAuth::checkOAuthValid();
             if ($r) {
                 // header('Location: ' . $callback);//刷新頁麵
                 return true;
             } else {
                 // exit('<h3>授權失敗,請重試</h3>');
                 return false;
             }
         } else {
             $url = OAuth::getAuthorizeURL($callback);
             header('Location: ' . $url);
         }
     }
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:59,代碼來源:qq.class.php

示例10: callback

 public function callback()
 {
     OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']);
     Tencent::$debug = $debug;
     $callback = SITE_DOMAIN . APP_ROOT . "/api_callback.php?c=Tencent";
     if (es_session::is_set('t_access_token') || es_session::is_set('t_openid') && es_session::is_set('t_openkey')) {
         //用戶已授權
         //echo '<pre><h3>已授權</h3>用戶信息:<br>';
         //獲取用戶信息
         $r = Tencent::api('user/info');
         $json_data = json_decode($r, true);
         //print_r($json_data);
         // echo '</pre>';
     } else {
         if ($_GET['code']) {
             //已獲得code
             $code = $_GET['code'];
             $openid = $_GET['openid'];
             $openkey = $_GET['openkey'];
             //獲取授權token
             $url = OAuth::getAccessToken($code, $callback);
             $r = Http::request($url);
             parse_str($r, $out);
             //存儲授權數據
             if ($out['access_token']) {
                 es_session::set('t_access_token', $out['access_token']);
                 es_session::set('refresh_token', $out['refresh_token']);
                 es_session::set('expires_in', $out['expires_in']);
                 es_session::set('t_code', $code);
                 es_session::set('t_openid', $openid);
                 es_session::set('t_openkey', $openkey);
                 //驗證授權
                 $r = OAuth::checkOAuthValid();
                 if ($r) {
                     app_redirect($callback);
                     //刷新頁麵
                 } else {
                     exit('<h3>授權失敗,請重試</h3>');
                 }
             } else {
                 exit($r);
             }
         } else {
             //獲取授權code
             if ($_GET['openid'] && $_GET['openkey']) {
                 //應用頻道
                 s_session::set('t_openid', $_GET['openid']);
                 es_session::set('t_openkey', $_GET['openkey']);
                 //驗證授權
                 $r = OAuth::checkOAuthValid();
                 if ($r) {
                     app_redirect($callback);
                     //刷新頁麵
                 } else {
                     exit('<h3>授權失敗,請重試</h3>');
                 }
             } else {
                 $url = OAuth::getAuthorizeURL($callback);
                 app_redirect($url);
             }
         }
     }
     if ($json_data['msg'] != "ok") {
         echo '<pre><h3>出錯了</h3><pre>';
         die;
     }
     $is_bind = intval($_REQUEST['is_bind']);
     $tencent_id = $json_data['data']['openid'];
     $msg['field'] = 'tencent_id';
     $msg['id'] = $tencent_id;
     $msg['name'] = $json_data['data']['name'];
     es_session::set("api_user_info", $msg);
     $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where tencent_id = '" . $tencent_id . "' and tencent_id <> ''");
     if ($user_data) {
         $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
         $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
         if ($user_current_group['score'] < $user_group['score']) {
             $user_data['group_id'] = intval($user_group['id']);
         }
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set tencent_app_key ='".$last_key['oauth_token']."',tencent_app_secret = '".$last_key['oauth_token_secret']."', login_ip = '".get_client_ip()."',login_time= ".TIME_UTC.",group_id=".intval($user_data['group_id'])." where id =".$user_data['id']);
         //$GLOBALS['db']->query("update ".DB_PREFIX."deal_cart set user_id = ".intval($user_data['id'])." where session_id = '".es_session::id()."'");
         es_session::delete("api_user_info");
         if ($is_bind) {
             if (intval($user_data['id']) != intval($GLOBALS['user_info']['id'])) {
                 showErr("該帳號已經被別的會員綁定過,請直接用帳號登錄", 0, url("shop", "uc_center#setweibo"));
             } else {
                 es_session::set("user_info", $user_data);
                 app_redirect(url("shop", "uc_center#setweibo"));
             }
         } else {
             es_session::set("user_info", $user_data);
             app_recirect_preview();
         }
     } elseif ($is_bind == 1 && $GLOBALS['user_info']) {
         //當有用戶身份且要求綁定時
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_id= '" . $tencent_id . "' where id =" . $GLOBALS['user_info']['id']);
         app_redirect(url("index", "uc_center#setweibo"));
     } else {
         $this->create_user();
         //app_redirect(url("index","user#api_login"));
//.........這裏部分代碼省略.........
開發者ID:workplayteam,項目名稱:P2P,代碼行數:101,代碼來源:Tencent_api.php


注:本文中的OAuth::getAuthorizeURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。