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


PHP curl::setToken方法代码示例

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


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

示例1: trim

 function __construct()
 {
     parent::__construct();
     $app = trim($this->input['app']);
     if (!$app) {
         $app = 'livworkbench';
     }
     $this->mApp = $app;
     $pre_release = intval($this->input['pre_release']);
     if (defined('NEED_AUTH') && NEED_AUTH) {
         include_once ROOT_PATH . 'lib/class/curl.class.php';
         $curl = new curl($this->mAuthServer['host'], $this->mAuthServer['dir']);
         $curl->mAutoInput = false;
         $curl->setClient($this->input['appid'], $this->input['appkey']);
         $curl->setToken('');
         $curl->initPostData();
         $postdata = array('a' => 'get_user_info');
         foreach ($postdata as $k => $v) {
             $curl->addRequestData($k, $v);
         }
         $ret = $curl->request('get_access_token.php');
         $ret = $ret[0];
         $this->mUser = $ret;
         if ($ret['install_type'] == 'pre-release') {
             $pre_release = 1;
         }
     }
     if ($pre_release) {
         $this->mVersionDir = 'pre-release/';
     } else {
         $this->mVersionDir = 'release/';
     }
     $version = trim($this->input['version']);
     $version_dir = $this->mRootDir . $this->mVersionDir;
     if (!$version) {
         $version = $this->getLastestVesion($version_dir);
     }
     $this->mProductDir = $version_dir;
     $this->mVersion = $version;
     if ($this->input['debug']) {
         echo '<pre>';
         print_r($this);
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:44,代码来源:upgrade.frm.php

示例2: dologin

 public function dologin()
 {
     $username = $this->input['username'];
     $password = $this->input['password'];
     $secret_value = $this->input['secret_value'];
     /*用户输入密保卡的值*/
     $security_zuo = $this->input['security_zuo'];
     /*密保卡坐标*/
     if ($this->settings['App_auth']) {
         //$this->show('授权服务器通信失败(配置文件缺失)!');
         $this->curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
         $this->curl->initPostData();
         $this->curl->addRequestData('appid', APPID);
         $this->curl->addRequestData('appkey', APPKEY);
         $this->curl->addRequestData('username', $username);
         $this->curl->addRequestData('password', $password);
         $this->curl->addRequestData('ip', hg_getip());
         //密保卡相关验证参数
         $this->curl->addRequestData('security_zuo', $security_zuo);
         $this->curl->addRequestData('secret_value', $secret_value);
         $ret = $this->curl->request('get_access_token.php');
         if ($ret['ErrorCode']) {
             $this->show($ret['ErrorCode'] . $ret['ErrorText']);
         }
         $ret = $ret[0];
         if ($ret['forced_change_pwd']) {
             //如果开启了强制修改密码,第一次登陆的时候必须修改密码
             $this->tpl->addVar('admin_id', $ret['id']);
             $this->tpl->addVar('user_name', $ret['user_name']);
             $this->tpl->outTemplate('change_pwd');
         }
         if ($ret['domain'] && $ret['domain'] != $_SERVER['HTTP_HOST']) {
             $this->show('用户名或密码错误');
         }
         if (!$ret['token']) {
             $_SESSION['livmcp_userinfo'] = array();
             $this->show('获取令牌错误!');
         }
         //客户端过期检测
         if ($ret['app_expire_time'] && $ret['app_expire_time'] < TIMENOW) {
             $_SESSION['livmcp_userinfo'] = array();
             $this->show('客户端授权到期');
         }
         if ($ret['default_page']) {
             if (substr($ret['default_page'], 0, 7) != 'http://') {
                 $ret['default_page'] = 'http://' . $ret['default_page'];
             }
         }
         if (is_file(CACHE_DIR . 'expire.m2o')) {
             if (!is_writeable(CACHE_DIR . 'expire.m2o')) {
                 $this->ReportError('请将' . CACHE_DIR . 'expire.m2o文件权限设置为可写');
             }
             $filemtime = filemtime(CACHE_DIR . 'expire.m2o');
             if (time() - $filemtime > 86400) {
                 $updateauth = true;
             } else {
                 $content = file_get_contents(CACHE_DIR . 'expire.m2o');
                 $license = hoge_de($content);
                 $updateauth = false;
                 if (!$license) {
                     $updateauth = true;
                 }
             }
         } else {
             $updateauth = true;
         }
         if ($updateauth) {
             $curl = new curl($this->settings['verify_custom_api']['host'], $this->settings['verify_custom_api']['dir']);
             $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
             $curl->setToken('');
             $curl->setErrorReturn('');
             $curl->setCurlTimeOut(10);
             $curl->mAutoInput = false;
             $curl->initPostData();
             $postdata = array('useappkey' => 1);
             foreach ($postdata as $k => $v) {
                 $curl->addRequestData($k, $v);
             }
             $auth = $curl->request('Authorization.php');
             if (is_array($auth)) {
                 if ($auth['ErrorCode'] == 'NO_APP_INFO') {
                     $this->ReportError('授权非法,请联系软件提供商');
                 }
                 if ($auth['ErrorCode'] == 'APP_AUTH_EXPIRED') {
                     $this->ReportError('授权已到期,请联系软件提供商');
                 }
             }
             $license = hoge_de($auth);
             if ($license) {
                 if ($license['appid']) {
                     file_put_contents(CACHE_DIR . 'expire.m2o', $auth);
                 }
             }
         }
         $timedelay = 0;
         if (intval($license['expire_time'])) {
             $license['expire'] = date('Y-m-d', $license['expire_time']);
             $license['leftday'] = intval(($license['expire_time'] - TIMENOW) / 86400);
             if ($license['expire_time'] < time()) {
                 $this->ReportError('授权已到期,请联系软件提供商');
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:login.php

示例3: curl

    if (!$content) {
        $needUpAuth = true;
    } else {
        $license = hoge_de($content);
        if (!$license['appid']) {
            $needUpAuth = true;
        } else {
            $needUpAuth = false;
        }
    }
}
if ($needUpAuth) {
    include ROOT_PATH . 'lib/class/curl.class.php';
    $curl = new curl($gGlobalConfig['verify_custom_api']['host'], $gGlobalConfig['verify_custom_api']['dir']);
    $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
    $curl->setToken('');
    $curl->setErrorReturn('');
    $curl->setCurlTimeOut(10);
    $curl->mAutoInput = false;
    $curl->initPostData();
    $postdata = array('useappkey' => 1);
    foreach ($postdata as $k => $v) {
        $curl->addRequestData($k, $v);
    }
    $content = $curl->request('Authorization.php');
    file_put_contents(CACHE_DIR . 'expire.m2o', $content);
    $license = hoge_de($content);
}
if ($license['domain']) {
    $gGlobalConfig['license'] = $license['domain'];
}
开发者ID:h3len,项目名称:Project,代码行数:31,代码来源:global.php

示例4: show

 public function show()
 {
     include ROOT_DIR . 'lib/class/cron.class.php';
     $crond = new crond();
     if ($this->settings['croncmd']) {
         $crond->setCronCmd($this->settings['croncmd']);
     }
     $cron_status = $crond->isRun();
     $curl = new curl($this->settings['verify_custom_api']['host'], $this->settings['verify_custom_api']['dir']);
     $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
     $curl->setToken('');
     $curl->setCurlTimeOut(5);
     $curl->setErrorReturn('');
     $curl->mAutoInput = false;
     $curl->initPostData();
     $postdata = array('a' => 'get_user_info');
     foreach ($postdata as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $license = $curl->request('get_access_token.php');
     if (!$license) {
         $this->ReportError('未获取到授权信息,请确认服务器网络正常或联系软件提供商');
     }
     if ($license['ErrorCode'] == 'APP_AUTH_EXPIRED') {
         $this->ReportError('授权已到期,请联系软件提供商');
     }
     $license = $license[0];
     if ($license['appid']) {
         $license['expire'] = date('Y-m-d', $license['expire_time']);
         $license['leftday'] = intval(($license['expire_time'] - TIMENOW) / 86400);
         $this->tpl->addVar('license', $license);
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setCurlTimeOut(5);
     $curl->setReturnFormat('json');
     $ret = $curl->request('applications.php');
     $instlled_apps = array();
     $app_stats = array();
     if (is_array($ret)) {
         foreach ($ret as $v) {
             $start_time = microtime();
             $result = $this->check_status($v);
             $v['runtime'] = hg_page_debug($start_time);
             $v['inited'] = $result[1]['define']['INITED_APP'];
             $v['debuged'] = $result[1]['debuged'];
             $v['http_code'] = $result[0]['http_code'];
             $v['db'] = $result[1]['db'];
             $v['dbconnected'] = $result[1]['dbconnected'];
             $v['connect_time'] = $result[1]['connect_time'];
             $v['ip'] = gethostbyname($v['host']);
             $v['db']['ip'] = gethostbyname($v['db']['host']);
             $v['api_dir'] = $result[1]['api_dir'];
             $v['config_file_purview'] = $result[1]['config_file_purview'];
             $v['data_file_purview'] = $result[1]['data_file_purview'];
             $v['cache_file_purview'] = $result[1]['cache_file_purview'];
             $v['freespace'] = $result[1]['freespace'];
             if ($v['bundle'] == $_GET['b']) {
                 print_r($v);
                 exit;
             }
             $app_stats[$v['bundle']] = $v;
         }
     }
     if ($this->settings['App_livmedia']) {
         $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir'] . 'admin/');
         $curl->setErrorReturn('');
         $curl->setCurlTimeOut(30);
         $curl->mAutoInput = false;
         $curl->initPostData();
         $curl->addRequestData('a', 'stats');
         $vod_status = $curl->request('vod.php');
         $vod_status = $vod_status[0];
     }
     $this->tpl->addVar('app_stats', $app_stats);
     $this->tpl->addVar('vod_status', $vod_status);
     $this->tpl->addVar('cron_status', $cron_status);
     $this->tpl->outTemplate('stats');
 }
开发者ID:h3len,项目名称:Project,代码行数:79,代码来源:stats.php


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