|
@@ -202,6 +202,43 @@ if (!function_exists('curl_c')) { |
|
@@ -202,6 +202,43 @@ if (!function_exists('curl_c')) { |
|
202
|
}
|
202
|
}
|
|
203
|
}
|
203
|
}
|
|
204
|
|
204
|
|
|
|
|
205
|
+if (!function_exists('curl_code')) {
|
|
|
|
206
|
+ /**
|
|
|
|
207
|
+ * @param $url
|
|
|
|
208
|
+ * @param $is_array
|
|
|
|
209
|
+ * @return []
|
|
|
|
210
|
+ * @author Akun
|
|
|
|
211
|
+ * @date 2023/11/22 11:33
|
|
|
|
212
|
+ */
|
|
|
|
213
|
+ function curl_code($url,$is_array=true){
|
|
|
|
214
|
+ $header = array(
|
|
|
|
215
|
+ 'Expect:',
|
|
|
|
216
|
+ 'Content-Type: application/json; charset=utf-8'
|
|
|
|
217
|
+ );
|
|
|
|
218
|
+ $ch = curl_init($url);
|
|
|
|
219
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
220
|
+ curl_setopt($ch, CURLOPT_HEADER, false);
|
|
|
|
221
|
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
|
222
|
+ 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');
|
|
|
|
223
|
+ curl_setopt($ch, CURLOPT_AUTOREFERER, true);
|
|
|
|
224
|
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
|
|
|
|
225
|
+ curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
|
|
|
226
|
+ curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
|
|
|
|
227
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
228
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
229
|
+ curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
|
|
|
|
230
|
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
|
231
|
+ $content = curl_exec($ch);
|
|
|
|
232
|
+ $http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
|
|
|
233
|
+ curl_close($ch);
|
|
|
|
234
|
+ if($http_code == 200){
|
|
|
|
235
|
+ return $is_array ? json_decode($content, true) : $content;
|
|
|
|
236
|
+ }else{
|
|
|
|
237
|
+ return $http_code;
|
|
|
|
238
|
+ }
|
|
|
|
239
|
+ }
|
|
|
|
240
|
+}
|
|
|
|
241
|
+
|
|
205
|
|
242
|
|
|
206
|
if (!function_exists('_get_child')) {
|
243
|
if (!function_exists('_get_child')) {
|
|
207
|
/**
|
244
|
/**
|