本文整理汇总了PHP中tools::http_curl_get方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::http_curl_get方法的具体用法?PHP tools::http_curl_get怎么用?PHP tools::http_curl_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::http_curl_get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tools
<?php
require_once "../includes/conn.php";
$tools = new tools();
$uwxcode = $_GET['uwxcode'];
$sk = intval($_GET['sk']);
$sh = intval($_GET['sh']);
$sysconfig = $dbconn->fetch($dbconn->query("select cappid,cappsecret,cdenglucode from " . DBQIAN . "sys_config limit 1"));
//获取用户的openid
if (isset($_GET['code']) && $_GET['code'] != '') {
$WXCODE = $_GET['code'];
$getucodeurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $sysconfig['cappid'] . "&secret=" . $sysconfig['cappsecret'] . "&code=" . $WXCODE . "&grant_type=authorization_code";
$getucodejson = json_decode($tools->http_curl_get($getucodeurl, true));
$ucode = $getucodejson->openid;
$wxlintoken = $getucodejson->access_token;
if ($ucode == '') {
header("Location:chaikai.index.php?sk=" . $sk . "&sh=" . $sh . "&uwxcode=" . $uwxcode);
exit;
}
$urow = $dbconn->fetch($dbconn->query("select uheadimgurl from " . DBQIAN . "user_list where ucode='{$ucode}' order by id desc limit 1"));
if ($sysconfig['cdenglucode'] == 2 || $urow['uheadimgurl'] != '') {
header("Location:chaikai.php?sk=" . $sk . "&sh=" . $sh . "&uwxcode=" . $uwxcode . "&ucode=" . $ucode);
exit;
}
if ($sysconfig['cdenglucode'] == 1 && $urow['uheadimgurl'] == '') {
$locaurl = urlencode(WEBNAME . "main/get.info.php?sk=" . $sk . "&sh=" . $sh . "&uwxcode=" . $uwxcode);
$urls = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . $sysconfig['cappid'] . "&redirect_uri=" . $locaurl . "&response_type=code&scope=snsapi_userinfo#wechat_redirect";
header("Location:" . $urls);
exit;
}
} else {
示例2: tools
<?php
require_once "../includes/conn.php";
$tools = new tools();
$uwxcode = $_GET['uwxcode'];
$sk = intval($_GET['sk']);
$sh = intval($_GET['sh']);
$sysconfig = mysql_fetch_array(mysql_query("select cappid,cappsecret,cdenglucode from " . DBQIAN . "sys_config order by id desc limit 1"));
//获取用户的openid
if (isset($_GET['code']) && $_GET['code'] != '') {
$WXCODE = $_GET['code'];
$getucodeurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $sysconfig['cappid'] . "&secret=" . $sysconfig['cappsecret'] . "&code=" . $WXCODE . "&grant_type=authorization_code";
$getucodejson = json_decode($tools->http_curl_get($getucodeurl));
$ucode = $getucodejson->openid;
$wxlintoken = $getucodejson->access_token;
if ($ucode == '') {
header("Location:chaikai.index.php?sk=" . $sk . "&sh=" . $sh . "&uwxcode=" . $uwxcode);
exit;
}
$usernum = $dbconn->countn(DBQIAN . "user_list", " ucode='{$ucode}' ");
$geturl = $getutxturl = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $wxlintoken . "&openid=" . $ucode . "&lang=zh_CN";
$getutxtjson = json_decode($tools->http_curl_get($geturl));
$uickname = iconv("UTF-8", "GBK", $getutxtjson->nickname);
$usex = intval($getutxtjson->sex);
$headimgurl = $getutxtjson->headimgurl;
$udizhi = iconv("UTF-8", "GBK", $getutxtjson->province) . iconv("UTF-8", "GBK", $getutxtjson->city);
$utime = time();
if ($usernum > 0) {
$dbconn->noretquery("update " . DBQIAN . "user_list set uickname='{$uickname}',\r\n\t\t\t\t\t usex={$usex},uheadimgurl='{$headimgurl}',udizhi='{$udizhi}' where ucode='{$ucode}' ");
} else {
$dbconn->noretquery("insert into " . DBQIAN . "user_list(ucode,uickname,usex,uheadimgurl,udizhi,utime)values\r\n\t\t\t\t ('{$ucode}','{$uickname}',{$usex},'{$headimgurl}','{$udizhi}',{$utime})");