|
...
|
...
|
@@ -202,6 +202,43 @@ if (!function_exists('curl_c')) { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!function_exists('curl_code')) {
|
|
|
|
/**
|
|
|
|
* @param $url
|
|
|
|
* @param $is_array
|
|
|
|
* @return []
|
|
|
|
* @author Akun
|
|
|
|
* @date 2023/11/22 11:33
|
|
|
|
*/
|
|
|
|
function curl_code($url,$is_array=true){
|
|
|
|
$header = array(
|
|
|
|
'Expect:',
|
|
|
|
'Content-Type: application/json; charset=utf-8'
|
|
|
|
);
|
|
|
|
$ch = curl_init($url);
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
|
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246');
|
|
|
|
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
|
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
|
|
|
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
|
$content = curl_exec($ch);
|
|
|
|
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
|
|
|
curl_close($ch);
|
|
|
|
if($http_code == 200){
|
|
|
|
return $is_array ? json_decode($content, true) : $content;
|
|
|
|
}else{
|
|
|
|
return $http_code;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('_get_child')) {
|
|
|
|
/**
|
...
|
...
|
|