|
@@ -235,14 +235,27 @@ function addacount($condition){
|
|
}
|
|
}
|
|
if(!function_exists("headerSign")){
|
|
if(!function_exists("headerSign")){
|
|
|
|
|
|
- function headerSign($post,$headerArr){
|
|
|
|
-
|
|
|
|
|
|
+ function headerSign($post){
|
|
|
|
+ $config = Config::get("sign");
|
|
|
|
+ $appid=$config['appid'];
|
|
|
|
+ $appkey=$config['appkey'];
|
|
|
|
+ $headerArr=["appid"=>'123',"noce"=>randomkeys(16),"sign"=>'',"timestamp"=>time()];
|
|
|
|
+ $value =array_merge($post,$headerArr);
|
|
|
|
+ $Sign= new \Sign($appid,$appkey);
|
|
|
|
+ $headerArr['sign'] = $Sign->makeSign($value);
|
|
|
|
+ $list=[];
|
|
|
|
+ foreach ($headerArr as $key=>$value){
|
|
|
|
+ $list[]=$key.":".$value;
|
|
|
|
+ }
|
|
|
|
+ return $list;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
|
|
//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
|
|
function curl_request($url,$post='',$header=["Content-Type: multipart/json;charset=utf-8"]){
|
|
function curl_request($url,$post='',$header=["Content-Type: multipart/json;charset=utf-8"]){
|
|
$header = empty($header) ? '' : $header;
|
|
$header = empty($header) ? '' : $header;
|
|
|
|
+ $singHead = headerSign($post);
|
|
|
|
+
|
|
if(is_array($post)) $post=json_encode($post,JSON_UNESCAPED_UNICODE);
|
|
if(is_array($post)) $post=json_encode($post,JSON_UNESCAPED_UNICODE);
|
|
$curl = curl_init();
|
|
$curl = curl_init();
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|