本文整理汇总了PHP中https_request函数的典型用法代码示例。如果您正苦于以下问题:PHP https_request函数的具体用法?PHP https_request怎么用?PHP https_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了https_request函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getaccesstoken
function getaccesstoken($appid, $appsecret) {
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret;
$result = https_request($url);
$jsoninfo = json_decode($result, true);
$access_token = $jsoninfo["access_token"];
return $access_token;
}
开发者ID:huzhongchun,项目名称:bbs,代码行数:7,代码来源:hj_function.php
示例2: test
public function test()
{
$url = __ROOT__ . '/getWxInfo.php';
$arr = https_request($url);
p($arr);
die;
}
开发者ID:PaulSunbinovic,项目名称:evcpc,代码行数:7,代码来源:TestAction.class.php
示例3: ip
public function ip()
{
$ip = $this->input->get('ip', TRUE);
$result = https_request("http://ipapi.sinaapp.com/api.php?f=json&ip={$ip}");
$data = json_decode($result, true);
echo $data['area1'];
}
开发者ID:tatfan,项目名称:fb_backend,代码行数:7,代码来源:api.php
示例4: get_token
function get_token()
{
$appid = "wx8f0a915f08327903";
$appsecret = "d4624c36b6795d1d99dcf0547af5443d";
$curl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$tokendata = https_request($curl);
$arrtoken = json_decode($tokendata, true);
return $arrtoken["access_token"];
}
开发者ID:hurongjiang,项目名称:mytest,代码行数:9,代码来源:get_token.php
示例5: getSubscribe
function getSubscribe($appid, $appsecret, $openid)
{
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$accessToken = https_request($url);
$accessToken = json_decode($accessToken, true);
$token = $accessToken['access_token'];
$dingyue_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$token}&openid={$openid}&lang=zh_CN";
$dingyue_json = https_request($dingyue_url);
return json_decode($dingyue_json, true);
}
开发者ID:noikiy,项目名称:meilala,代码行数:10,代码来源:index.php
示例6: getwuserinfo
function getwuserinfo($postObj, $appid, $appsecret)
{
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$result = https_request($url);
$jsoninfo = json_decode($result, true);
$access_token = $jsoninfo["access_token"];
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $postObj->FromUserName . "&lang=zh_CN";
$wuser = https_request($url);
$wuser = json_decode($wuser, true);
return $wuser;
}
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:11,代码来源:function_core.php
示例7: get_userinfo
function get_userinfo($code, $cfg)
{
//====获取access_token
$access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $cfg['appid'] . "&secret=" . $cfg['appsecret'] . "&code=" . $code . "&grant_type=authorization_code";
$access_token_result = https_request($access_token_url);
$access_token_arr = json_decode($access_token_result, true);
//====获取用户信息
$userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token_arr['access_token'] . "&openid=" . $access_token_arr['openid'];
$userinfo_result = https_request($userinfo_url);
$userinfo_arr = json_decode($userinfo_result, true);
return $userinfo_arr;
}
开发者ID:ypengshop,项目名称:wx,代码行数:12,代码来源:oauth.php
示例8: url2arr
function url2arr($url, $json)
{
if (C('psnvs') != 1) {
$json = https_request($url);
}
$arr = json_decode($json, true);
if ($arr['code'] != 'A00000') {
logger('#', 'log/log_' . date('Y-m-d', time()) . '.txt');
logger('url: ' . $url, 'log/log_' . date('Y-m-d', time()) . '.txt');
logger('json: ' . $json, 'log/log_' . date('Y-m-d', time()) . '.txt');
}
$arr['url'] = $url;
return $arr;
}
开发者ID:PaulSunbinovic,项目名称:xxx,代码行数:14,代码来源:common.php
示例9: getUserInfo
function getUserInfo($code)
{
$appid = "wx112a5b680de6941e";
$appsecret = "bc85e6bec70db896784884ec28151598";
//获取access token和openid https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
$new_access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$appsecret}&code={$code}&grant_type=authorization_code";
$new_access_token_json = https_request($new_access_token_url);
$new_access_token_array = json_decode($new_access_token_json, true);
$new_access_token = $new_access_token_array['access_token'];
//全局access token获得用户基本信息https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
$userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$new_access_token}&openid={$openid}&lang=zh_CN";
$userinfo_json = https_request($userinfo_url);
$userinfo_array = json_decode($userinfo_json, true);
return $userinfo_array;
}
开发者ID:Momo707577045,项目名称:WeiXin,代码行数:15,代码来源:oauth2_openid.php
示例10: getUserInfo
function getUserInfo($code)
{
$appid = "wx0fed524d0dbafd1e";
$appsecret = "b3fca70bef3775f844f3597bb09a2e9d";
// oauth2的方式获得openid
$access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$appsecret}&code={$code}&grant_type=authorization_code";
$access_token_json = https_request($access_token_url);
$access_token_array = json_decode($access_token_json, true);
$openid = $access_token_array['openid'];
// 非oauth2的方式获得全局access token
$new_access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$new_access_token_json = https_request($new_access_token_url);
$new_access_token_array = json_decode($new_access_token_json, true);
$new_access_token = $new_access_token_array['access_token'];
// 全局access token获得用户基本信息
$userinfo_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$new_access_token}&openid={$openid}";
$userinfo_json = https_request($userinfo_url);
$userinfo_array = json_decode($userinfo_json, true);
return $userinfo_array;
}
开发者ID:lincome,项目名称:wechat-O2O-hyk,代码行数:20,代码来源:oauth2_openid.php
示例11: getUserInfo
function getUserInfo($code, $appid, $appsecret)
{
// $appid = "wx08c69e5ad5cc1a5e";
// $appsecret = "95c2d97c3557a65b5f6f7e962b363256";
//oauth2的方式获得openid
$access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$appsecret}&code={$code}&grant_type=authorization_code";
$access_token_json = https_request($access_token_url);
$access_token_array = json_decode($access_token_json, true);
$openid = $access_token_array['openid'];
//非oauth2的方式获得全局access token
$new_access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$new_access_token_json = https_request($new_access_token_url);
$new_access_token_array = json_decode($new_access_token_json, true);
$new_access_token = $new_access_token_array['access_token'];
//全局access token获得用户基本信息
$userinfo_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$new_access_token}&openid={$openid}";
$userinfo_json = https_request($userinfo_url);
$userinfo_array = json_decode($userinfo_json, true);
return $userinfo_array;
}
开发者ID:PaulSunbinovic,项目名称:xx,代码行数:20,代码来源:oauth2_openid.php
示例12: getTicket
function getTicket($access_token, $tempewm)
{
$data = json_decode(file_get_contents("jsapi_ticket.json"));
if ($data->expire_time < time()) {
// 如果是企业号用以下URL获取access_token
// $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret";
$url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" . $access_token;
$res = json_decode(https_request($url, $tempewm));
$jsapi_ticket = $res->ticket;
if ($jsapi_ticket) {
$data->expire_time = time() + 7000;
$data->jsapi_ticket = $jsapi_ticket;
$fp = fopen("jsapi_ticket.json", "w");
fwrite($fp, json_encode($data));
fclose($fp);
}
} else {
$jsapi_ticket = $data->jsapi_ticket;
}
return $jsapi_ticket;
}
开发者ID:ypengshop,项目名称:wx,代码行数:21,代码来源:ewm.php
示例13: getJsApiTicket
function getJsApiTicket($accessToken)
{
// jsapi_ticket 应该全局存储与更新,以下代码以写入到文件中做示例
$data = json_decode(file_get_contents("jsapi_ticket.json"));
if ($data->expire_time < time()) {
// 如果是企业号用以下 URL 获取 ticket
// $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=" . $accessToken;
$res = json_decode(https_request($url));
$ticket = $res->ticket;
if ($ticket) {
$data->expire_time = time() + 7000;
$data->jsapi_ticket = $ticket;
$fp = fopen("jsapi_ticket.json", "w");
fwrite($fp, json_encode($data));
fclose($fp);
}
} else {
$ticket = $data->jsapi_ticket;
}
return $ticket;
}
开发者ID:ypengshop,项目名称:wx,代码行数:22,代码来源:map.php
示例14: https_request
{
"type":"view",
"name":"联系方式",
"url":"http://www.toptophr.com/company/index.php?id=' . $_GET['uid'] . '&tp=connection&style=wap"
},
{
"type":"view",
"name":"地理位置",
"url":"http://www.toptophr.com/company/index.php?id=' . $_GET['uid'] . '&tp=position&style=wap"
}]
}]
}';
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $access_token;
$result = https_request($url, $jsonmenu);
var_dump($result);
function https_request($url, $data = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return $output;
开发者ID:keyu199314,项目名称:php,代码行数:31,代码来源:wxmenu.php
示例15: https_request
require_once '../utils/Access_Token.class.php';
//$access_tokenApiObj = new Access_TokenApi();
//$access_token = $access_tokenApiObj->getAccess_Token();
$access_token = 'L43i6Tzh7k32FhT915yIOKcDipQODRiqubUByIh0asFTnCzy0YYzb5QJbsghECWBCtpi56bxwHaSqHS0BDBwAsSuDAGXEbhxxCqLSvrzU3g';
$openid = "oGer5jnhIvxmzFKZEtGnrv_yzHBc";
$data = '{
"touser":"' . $openid . '",
"msgtype":"text",
"text":
{
"content":"Hello World"
}
}';
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $access_token;
$result = https_request($url, $data);
var_dump($result);
function https_request($url, $data)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
if (curl_errno($curl)) {
return 'Errno' . curl_error($curl);
}
curl_close($curl);
开发者ID:mesfreeman,项目名称:ifreeweixin,代码行数:30,代码来源:kefu.php
示例16: getOrderInfo
/**
* 获取订单信息
* @param string $value [description]
* @return [type] [description]
*/
public function getOrderInfo($trans_no, $type = 'normal')
{
$this->getMD5SIGN($trans_no);
$data = $this->getField($trans_no);
$result = https_request($this->orderInfo_url, $data);
if (empty($result)) {
return array('status' => '0');
}
$ckResult = explode('|', $result);
$oData = array('MemberID' => $ckResult[0], 'TerminalID' => $ckResult[1], 'TransID' => $ckResult[2], 'CheckResult' => $ckResult[3], 'succMoney' => $ckResult[4], 'SuccTime' => $ckResult[5], 'Md5Sign' => $ckResult[6]);
$ck = $this->ckMD5SIGN($oData);
if ($ck) {
if ($type == 'normal') {
return array('status' => '1', 'TransID' => $oData['TransID'], 'succMoney' => $oData['succMoney'] / 100, 'SuccTime' => date('Y-m-d H:i:s', strtotime($oData['SuccTime'])), 'CheckResult' => $oData['CheckResult']);
} elseif ($type == 'all') {
return $oData;
}
} else {
return array('status' => '0');
}
}
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:26,代码来源:Pay.php
示例17: getUserInfo
function getUserInfo($code)
{
$appid = "wxfb9fe4614872cea1";
$appsecret = "e61c7b972bceb87145ab150d70061c74";
//oauth2的方式获得openid
$access_token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $appsecret . "&code=" . $code . "&grant_type=authorization_code";
$access_token_json = https_request($access_token_url);
$access_token_array = json_decode($access_token_json, true);
$openid = $access_token_array['openid'];
$access_token = $access_token_array['access_token'];
/*
//非oauth2的方式获得全局access token
$new_access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret;
$new_access_token_json = https_request($new_access_token_url);
$new_access_token_array = json_decode($new_access_token_json, true);
$new_access_token = $new_access_token_array['access_token'];
//全局access token获得用户基本信息
$userinfo_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=".$new_access_token."&openid=".$openid;
$userinfo_json = https_request($userinfo_url);
$userinfo_array = json_decode($userinfo_json, true);
return $userinfo_array;
*/
//oauth2获得用户基本信息
$userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token . "&openid=" . $openid;
$userinfo_json = https_request($userinfo_url);
$userinfo_array = json_decode($userinfo_json, true);
return $userinfo_array;
}
开发者ID:shihang1228,项目名称:mcr_new,代码行数:29,代码来源:oauth2_openid.php
示例18: send_template_message
function send_template_message($data)
{
$access_token = get_access_token();
$url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token;
$result = https_request($url, $data);
return json_decode($result, true);
}
开发者ID:winiceo,项目名称:job,代码行数:7,代码来源:common.fun.php
示例19: libfile
require_once libfile('function/member');
$result = userlogin($_GET['username'], $_GET['password']);
if (empty($result['status'])) {
showmessage(lang('plugin/aljwsq', 'bind4'));
}
if (empty($openid)) {
showmessage(lang('plugin/aljwsq', 'bind5'));
}
$config = $_G['cache']['plugin']['aljwsq'];
if ($config['appid'] && $config['appsecret']) {
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $config['appid'] . "&secret=" . $config['appsecret'];
$result = https_request($url);
$jsoninfo = json_decode($result, true);
$access_token = $jsoninfo["access_token"];
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $_GET['openid'] . "&lang=zh_CN";
$wuser = https_request($url);
$wuser = json_decode($wuser, true);
}
if ($openid) {
if (!$user && $openid) {
C::t('#aljwsq#aljwsq_user')->insert(array('nickname' => u2g($wuser['nickname']), 'username' => $_GET['username'], 'openid' => $openid, 'latitude' => $_GET['latitude'], 'longitude' => $_GET['longitude'], 'bindtime' => TIMESTAMP, 'sex' => $wuser['sex'], 'city' => u2g($wuser['city']), 'country' => u2g($wuser['country']), 'province' => u2g($wuser['province']), 'language' => $wuser['language'], 'headimgurl' => $wuser['headimgurl'], 'subscribe_time' => TIMESTAMP));
} else {
C::t('#aljwsq#aljwsq_user')->update($openid, array('nickname' => u2g($wuser['nickname']), 'username' => $_GET['username'], 'latitude' => $_GET['latitude'], 'longitude' => $_GET['longitude'], 'bindtime' => TIMESTAMP, 'sex' => $wuser['sex'], 'city' => u2g($wuser['city']), 'country' => u2g($wuser['country']), 'province' => u2g($wuser['province']), 'language' => $wuser['language'], 'headimgurl' => $wuser['headimgurl']));
}
}
showmessage(lang('plugin/aljwsq', 'bind6'), 'forum.php?openid=' . $openid);
} else {
$binduser = DB::fetch_first('SELECT * FROM %t WHERE openid=%s', array('aljwsq_user', $openid));
if ($binduser && $binduser['username']) {
echo '<script>alert("' . $config['albindtips'] . '");location.href="forum.php?mobile=2&openid=' . $openid . '"</script>';
exit;
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:31,代码来源:bind.inc.php
示例20: getDeviceList
function getDeviceList($MWID)
{
$deviceListUrl = "http://www.cloudsensing.cn:9071/WIFPa/MWAttribute/" . "{$MWID}" . ".xml";
$deviceList = https_request($deviceListUrl);
return $deviceList;
}
开发者ID:stczwd,项目名称:wot_gateway,代码行数:6,代码来源:oauth2_openid.php
注:本文中的https_request函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论