|
本帖最后由 Telegramr 于 2025-2-28 10:16 编辑
先说声谢谢了
有一个PHP获取双色球开奖信息的功能,现在遇到一个很奇怪的问题,在本地调试的时候正常,但在服务器上运行的时候出现异常,提示 Error: Maximum (10) redirects followed
问遍了所有ai下都找不到问题在哪,所以现在向各位大佬们请教一下,谢谢大家了。
ssq.rar
(2.09 KB, 下载次数: 8)
curl_debug.rar
(1.37 KB, 下载次数: 4)
这段代码,在本地php+nginx下没有任何问题,但是在服务器上却打开网页就显示 Error: Maximum (10) redirects followed 错误,同时curl获取不到任何数据。
本地调试环境:
PHP 7.0.33 (cli) (built: Oct 10 2024 09:07:20) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
nginx:1.2.2
服务器环境:
PHP 7.3.33 (cli) (built: Aug 23 2022 12:54:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
nginx:nginx/1.21.6
在服务器上命令行执行curl命令同样返回这个错误提示,按道理说不应该是IP被封,因为以前没有对这个网址做过操作。谢谢大家了。
- curl -L -X GET "https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5" \
- > -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" \
- > -H "Referer: https://www.cwl.gov.cn/" \
- > -H "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" \
- > -H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8" \
- > -H "Accept-Encoding: gzip, deflate, br, zstd" \
- > -H "Cache-Control: max-age=0" \
- > -H "Connection: keep-alive" \
- > -H "Cookie: 21_vq=9; HMF_CI=96ce8230eb88a79f892aefc97605870f4c3e6a7826499fdd1a4663e39a878a352ab87872e84207f940421846dc3cad1ea727aef41e54c73a95c2ee89acf3a2a181"
- curl: (47) Maximum (50) redirects followed
复制代码
chatgpt指导下的返回信息
- curl -L -v --max-redirs 100 -X GET "https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC" \
- -H "User-Agent: baidu:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" \
- -H "Referer: https://www.cwl.gov.cn/" \
- -H "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" \
- -H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8" \
- -H "Accept-Encoding: gzip, deflate, br, zstd" \
- -H "Cache-Control: max-age=0" \
- -H "Connection: keep-alive" \
- -H "Cookie: 21_vq=9; HMF_CI=96ce8230eb88a79f892aefc97605870f09846e72de625cb216052159c751b0656906343280a05f6ecd334d49c2f5bce058e4a38f6125c41d6ad49e5d8b6163c9a7"
复制代码
< HTTP/1.1 302 Moved Temporarily
< Server: nginx
< Date: Fri, 28 Feb 2025 02:11:34 GMT
< Content-Type: text/html
< Content-Length: 138
< Connection: keep-alive
< Cache-Control: no-store
< Location: https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC
< x-ws-request-id: 67c11b56_PS-JJN-01wa2247_64743-919
< Set-Cookie: HMF_CI=96ce8230eb88a79f892aefc97605870fc4779740f71f0e749300291daecfcc32c9ea6cfe7736aa2cf993ef4782f7f87b1f448c009101c148709fbd1ad72551597f; Expires=Sun, 30-Mar-25 02:11:34 GMT; Path=/
<
* Ignoring the response-body
* Connection #0 to host www.cwl.gov.cn left intact
* Issue another request to this URL: 'https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC'
* Re-using existing connection! (#0) with host www.cwl.gov.cn
* Connected to www.cwl.gov.cn (27.148.164.154) port 443 (#0)
> GET /cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC HTTP/1.1
> Host: www.cwl.gov.cn
> User-Agent: baidu:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
> Referer: https://www.cwl.gov.cn/
> 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, br, zstd
> Cache-Control: max-age=0
> Connection: keep-alive
> Cookie: 21_vq=9; HMF_CI=96ce8230eb88a79f892aefc97605870f09846e72de625cb216052159c751b0656906343280a05f6ecd334d49c2f5bce058e4a38f6125c41d6ad49e5d8b6163c9a7
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx
< Date: Fri, 28 Feb 2025 02:11:34 GMT
< Content-Type: text/html
< Content-Length: 138
< Connection: keep-alive
< Cache-Control: no-store
< Location: https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC
< x-ws-request-id: 67c11b56_PS-JJN-01wa2247_64743-920
< Set-Cookie: HMF_CI=96ce8230eb88a79f892aefc97605870fc4779740f71f0e749300291daecfcc63c9ea6cfe7736aa2cf993ef4782f7f87b1f448c009101c148709fbd1ad72551597f; Expires=Sun, 30-Mar-25 02:11:34 GMT; Path=/
<
* Ignoring the response-body
* Connection #0 to host www.cwl.gov.cn left intact
* Issue another request to this URL: 'https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC'
* Re-using existing connection! (#0) with host www.cwl.gov.cn
* Connected to www.cwl.gov.cn (27.148.164.154) port 443 (#0)
> GET /cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC HTTP/1.1
> Host: www.cwl.gov.cn
> User-Agent: baidu:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
> Referer: https://www.cwl.gov.cn/
> 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, br, zstd
> Cache-Control: max-age=0
> Connection: keep-alive
> Cookie: 21_vq=9; HMF_CI=96ce8230eb88a79f892aefc97605870f09846e72de625cb216052159c751b0656906343280a05f6ecd334d49c2f5bce058e4a38f6125c41d6ad49e5d8b6163c9a7
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx
< Date: Fri, 28 Feb 2025 02:11:34 GMT
< Content-Type: text/html
< Content-Length: 138
< Connection: keep-alive
< Cache-Control: no-store
< Location: https://www.cwl.gov.cn/cwl_admin/front/cwlkj/search/kjxx/findDrawNotice?name=ssq&issueCount=5&pageNo=1&pageSize=5&systemType=PC
< x-ws-request-id: 67c11b56_PS-JJN-01wa2247_64743-921
< Set-Cookie: HMF_CI=96ce8230eb88a79f892aefc97605870fc4779740f71f0e749300291daecfcc39c9ea6cfe7736aa2cf993ef4782f7f87b1f448c009101c148709fbd1ad72551597f; Expires=Sun, 30-Mar-25 02:11:34 GMT; Path=/
<
* Ignoring the response-body
* Connection #0 to host www.cwl.gov.cn left intact
* Maximum (100) redirects followed
curl: (47) Maximum (100) redirects followed
* Closing connection #0
微信图片_20250227172853.png
(24.92 KB, 下载次数: 0)
微信图片_20250227172914.png
(31.2 KB, 下载次数: 0)
|
|