作者 lyh

gx

@@ -88,19 +88,19 @@ if (!function_exists('http_get')) { @@ -88,19 +88,19 @@ if (!function_exists('http_get')) {
88 function http_get($url, $header = []) 88 function http_get($url, $header = [])
89 { 89 {
90 if (empty($header)) { 90 if (empty($header)) {
91 - $header[] = "content-type: application/json;  
92 - charset = UTF-8"; 91 + $header[] = "content-type: application/json";
93 } 92 }
94 $ch1 = curl_init(); 93 $ch1 = curl_init();
95 $timeout = 0; 94 $timeout = 0;
96 curl_setopt($ch1, CURLOPT_URL, $url); 95 curl_setopt($ch1, CURLOPT_URL, $url);
97 curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); 96 curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  97 + curl_setopt($ch1, CURLOPT_ENCODING, '');
  98 + curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
98 curl_setopt($ch1, CURLOPT_HTTPHEADER, $header); 99 curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
99 curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout); 100 curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
100 - curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);  
101 curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true); 101 curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
102 curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET'); 102 curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
103 - curl_setopt($ch1, CURLOPT_HTTP_VERSION, false); 103 + curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
104 $access_txt = curl_exec($ch1); 104 $access_txt = curl_exec($ch1);
105 curl_close($ch1); 105 curl_close($ch1);
106 return json_decode($access_txt, true); 106 return json_decode($access_txt, true);