作者 lyh

gx

@@ -62,16 +62,31 @@ if (!function_exists('http_post')) { @@ -62,16 +62,31 @@ if (!function_exists('http_post')) {
62 ); 62 );
63 } 63 }
64 $ch = curl_init(); 64 $ch = curl_init();
  65 +// curl_setopt($ch, CURLOPT_URL, $url);
  66 +// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  67 +// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  68 +// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  69 +// curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  70 +// curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
  71 +// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  72 +// curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
  73 +// curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  74 +// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
65 curl_setopt($ch, CURLOPT_URL, $url); 75 curl_setopt($ch, CURLOPT_URL, $url);
66 - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 76 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  77 + curl_setopt($ch, CURLOPT_HEADER, false);
  78 + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  79 + 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');
  80 + curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  81 + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
  82 + curl_setopt($ch, CURLOPT_TIMEOUT, 120);
  83 + curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
67 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 84 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
68 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 85 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
69 - curl_setopt($ch, CURLOPT_HTTPHEADER, $header);  
70 - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');  
71 - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);  
72 - curl_setopt($ch, CURLOPT_AUTOREFERER, 1); 86 + curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
73 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); 87 curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
74 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 88 + curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  89 + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
75 $res = curl_exec($ch); 90 $res = curl_exec($ch);
76 if (curl_errno($ch)) { 91 if (curl_errno($ch)) {
77 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND); 92 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);