diff --git a/app/controller/Crawler.php b/app/controller/Crawler.php index c3ab17f..a440170 100644 --- a/app/controller/Crawler.php +++ b/app/controller/Crawler.php @@ -64,10 +64,19 @@ class Crawler extends BaseController curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8', + 'Accept-Encoding: gzip, deflate', + 'Cache-Control: no-cache', + 'Connection: keep-alive', 'Cookie: ' . $cookieString, 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Referer: http://gzrsks.oumakspt.com:62/tyzpwb/', + 'Upgrade-Insecure-Requests: 1', ]); $html = curl_exec($ch); diff --git a/app/service/CrawlerService.php b/app/service/CrawlerService.php index 95f3ac0..05e4317 100644 --- a/app/service/CrawlerService.php +++ b/app/service/CrawlerService.php @@ -29,9 +29,20 @@ class CrawlerService $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Cookie: ' . $cookieString, + 'Accept: application/json, text/javascript, */*; q=0.01', + 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8', + 'Accept-Encoding: gzip, deflate', + 'Cache-Control: no-cache', + 'Connection: keep-alive', 'Content-Type: application/x-www-form-urlencoded', + 'Cookie: ' . $cookieString, + 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', + 'Referer: http://gzrsks.oumakspt.com:62/tyzpwb/', + 'X-Requested-With: XMLHttpRequest', ]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['dsdm' => $dsdm])); @@ -76,9 +87,20 @@ class CrawlerService $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Cookie: ' . $cookieString, + 'Accept: application/json, text/javascript, */*; q=0.01', + 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8', + 'Accept-Encoding: gzip, deflate', + 'Cache-Control: no-cache', + 'Connection: keep-alive', 'Content-Type: application/x-www-form-urlencoded', + 'Cookie: ' . $cookieString, + 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', + 'Referer: http://gzrsks.oumakspt.com:62/tyzpwb/', + 'X-Requested-With: XMLHttpRequest', ]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ diff --git a/view/crawler/index.html b/view/crawler/index.html index a792230..5a90579 100644 --- a/view/crawler/index.html +++ b/view/crawler/index.html @@ -246,19 +246,13 @@