|
|

10精币
我想下载一个查询结果生成的PDF文件,大致流程是这样的
1、访问查询页面
2、输入待查询信息
3、点击验证码
4、显示查询结果
5、下载文件
前4步我都实现了,现在卡在了最后一步
这是访问下载链接的信息包
GET https://cx.hbea.edu.cn/yyky/2026/export-pdf HTTP/1.1
Host: cx.hbea.edu.cn
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
sec-ch-ua-platform: "Windows"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
sec-ch-ua-mobile: ?0
Accept: */*
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://cx.hbea.edu.cn/yyky/2026/13e1ba1c-8b29-4d67-88ff-47ffe84b8e8c?
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cookie: device_id=device_a9cbc1be0108202ea1bae499b09364ab; hbea_exam_session=2rlUTDSXRYNVasJKdbUMiDLcjR069ybmcj2IX6zW+Sg=lzE5qr14emCnEwNjRjGCaw
这是返回的协议头
HTTP/1.1 200 OK
Date: Fri, 12 Jun 2026 08:16:27 GMT
Content-Type: application/pdf
Content-Length: 269017
Connection: keep-alive
content-disposition: inline; filename="326011022000102.pdf"
x-content-type-options: nosniff
cache-control: no-cache, no-store, must-revalidate
pragma: no-cache
expires: 0
vary: origin, access-control-request-method, access-control-request-headers
vary: accept-encoding
access-control-allow-credentials: true
access-control-expose-headers: x-csrf-token,x-rate-limit-id
x-frame-options: DENY
x-xss-protection: 1; mode=block
referrer-policy: strict-origin-when-cross-origin
content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://hm.baidu.com https://*.hm.baidu.com https://cx.hbea.edu.cn https://www.hbea.edu.cn; script-src-elem 'self' 'unsafe-inline' https://hm.baidu.com https://*.hm.baidu.com https://cx.hbea.edu.cn https://www.hbea.edu.cn; style-src 'self' 'unsafe-inline' https://cx.hbea.edu.cn https://www.hbea.edu.cn; img-src 'self' data: https://www.hbea.edu.cn https://hm.baidu.com https://*.hm.baidu.com; font-src 'self' https://cx.hbea.edu.cn; connect-src 'self' https://hm.baidu.com https://*.hm.baidu.com https://cx.hbea.edu.cn https://www.hbea.edu.cn; media-src 'self' blob:; object-src 'none'; child-src 'self' blob:; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; upgrade-insecure-requests
x-download-options: noopen
x-permitted-cross-domain-policies: none
permissions-policy: geolocation=(), microphone=(), camera=()
cross-origin-opener-policy: same-origin-allow-popups
在fiddler中可以看到访问后的内容,是文件流,但是我无法将文件保存下来。
下面是待查询信息
26421022110007
421022200810241847
|
最佳答案
查看完整内容
服务器可能会根据当前会话中最后一次cha询结果动态生成 PDF,所以必须在cha询成功后立即用同一个会话访问该下载地址
回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。 友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。 快捷通道:申请荣誉值 →
|