예제 #1
0
파일: auth2.php 프로젝트: dlpc/ecshop
print_r($arr_request);
echo '</pre>';
$obj_weixin = new weixin();
/**
 * 网页授权获取用户基本信息
 */
if ($str_action == 'oauth') {
    /**
     * code说明 :
     * code作为换取access_token的票据,每次用户授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期。
     */
    /**/
    $arr_data = array();
    $arr_data['action'] = 'oauth_access_token';
    $arr_data['code'] = $str_code;
    $arr_result = $obj_weixin->weixin($arr_data);
    //echo '-oauth2-'.'<br/>';
    //echo '<pre>';
    //print_r($arr_result);
    //echo '</pre>';
    /*
    	//返回数据
    	$arr_result = array();
        $arr_result['access_token'] = 'OezXcEiiBSKSxW0eoylIePVeTYBNndr3I0NlzF49udAiHLaGPkZ4CHwntPexYuveImVcNExP4FocwDCa4ZjmsNzl4cEqCht72TbptqLnOmuHdwWe7ecP50GTzUYdM5q0692ySngG1Mg312sQvjMM0Q';
        $arr_result['expires_in'] = '7200';
        $arr_result['refresh_token'] = 'OezXcEiiBSKSxW0eoylIePVeTYBNndr3I0NlzF49udAiHLaGPkZ4CHwntPexYuveFB0pHC4OzYrG4rSERKfqyy380u3mi5oM26E1bEUD2ZB152Euch4OW_S5zV4SwLXmamkJmOs3hRgmjhGGzWXI_Q';
        $arr_result['openid'] = 'oIQ5Vtxp0W4Cb-MIJP2lho-cH82c';
        $arr_result['scope'] = 'snsapi_base';
    */
    if (is_array($arr_result) && $arr_result['errcode'] != '0') {
        //获取基础 access_token
예제 #2
0
파일: api.php 프로젝트: dlpc/ecshop
    //时间戳
    $str_signature = strval(trim($_REQUEST['signature']));
    //签名字串
    /*
    $str_echostr = '3458335650061737471';
    $str_nonce = '627010994';
    $str_timestamp = '1405049982';
    $str_signature = 'f5d9d92c47b52da4215ff632aa6e25424fe2ebbf';
    */
    $arr_data = array();
    $arr_data['action'] = 'check_dev';
    $arr_data['timestamp'] = $str_timestamp;
    $arr_data['nonce'] = $str_nonce;
    $arr_data['signature'] = $str_signature;
    //$arr_data['echostr'] = $str_echostr;
    $bol_result = $obj_weixin->weixin($arr_data);
    if ($bol_result) {
        die($str_echostr);
    } else {
        die('Error');
    }
}
/**
 * 获取access_token
 */
if ($str_action == 'access_token') {
    $arr_data = array();
    $arr_data['action'] = 'access_token';
    $arr_result = $obj_weixin->weixin($arr_data);
    echo '<pre>';
    print_r($arr_result);
예제 #3
0
파일: auth.php 프로젝트: dlpc/ecshop
$arr_articles[2]['title'] = iconv('GBK','UTF-8'.'//IGNORE','汤唯');
$arr_articles[2]['description'] = iconv('GBK','UTF-8'.'//IGNORE','汤唯拄拐杖抵港宣传新戏 获十余人护送 2 描述2');
$arr_articles[2]['url'] = 'http://news.163.com/14/0806/02/A2UBORB000014AED.html';
$arr_articles[2]['picurl'] = 'http://img4.cache.netease.com/photo/0003/2014-08-06/900x600_A2U9541P00AJ0003.jpg';

$arr_data['news']['articles'] = $arr_articles; 


$str_qstring = json_encode($arr_data);
echo '<pre>';
print_r($str_qstring);
echo '</pre>';
exit;
*/
$str_action = 'oauth';
$obj_weixin = new weixin();
/**
 * 网页授权获取用户基本信息
 */
if ($str_action == 'oauth') {
    $arr_data = array();
    $arr_data['action'] = 'oauth';
    $arr_result = $obj_weixin->weixin($arr_data);
    //echo '<pre>';
    //print_r($arr_result);
    //echo '</pre>';
    //	if (is_array($arr_result)) {
    //		header("Location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxe7f55d599239f618&redirect_uri=http%3A%2F%2Fwww.91ka.com%2Fif%2Fweixin%2Fauth2.php&response_type=code&scope=snsapi_base&state=test#wechat_redirect");
    //	}
}