正在显示
1 个修改的文件
包含
8 行增加
和
24 行删除
| @@ -62,36 +62,20 @@ if (!function_exists('http_post')) { | @@ -62,36 +62,20 @@ 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); | ||
| 75 | curl_setopt($ch, CURLOPT_URL, $url); | 65 | curl_setopt($ch, CURLOPT_URL, $url); |
| 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); | 66 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
| 84 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | 67 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
| 85 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | 68 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
| 86 | - curl_setopt($ch, CURLOPT_SSLVERSION, 'all'); | ||
| 87 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); | ||
| 88 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); | 69 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); |
| 89 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | 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); | ||
| 90 | $res = curl_exec($ch); | 75 | $res = curl_exec($ch); |
| 91 | if (curl_errno($ch)) { | 76 | if (curl_errno($ch)) { |
| 92 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND); | ||
| 93 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($post_data, true) . PHP_EOL, FILE_APPEND); | ||
| 94 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($ch, true) . PHP_EOL, FILE_APPEND); | 77 | + $error_message = curl_error($ch); |
| 78 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); | ||
| 95 | @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND); | 79 | @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND); |
| 96 | } | 80 | } |
| 97 | curl_close($ch); | 81 | curl_close($ch); |
-
请 注册 或 登录 后发表评论