WebRequestHelper是我用VB6开发的网页请求辅助工具,可以在软件界面中设置请求方式、请求头,然后自动生成VB代码。
下面假设要请求 http://www.dpxq.com/hldcg/search/list.asp?owner=ryueifu&page=4 这个网址,预先在浏览器中使用开发工具获取到如下:
GET /hldcg/search/DhtmlXQ_www_dpxq_com.htm HTTP/1.1
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-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Cookie: ASPSESSIONIDQADRRBQR=LJNCKPOBDMPNKIALGJIAPBCB; Hm_lvt_f6e61cf1824cdc5229627cb4f977c9b7=1736226040,1736516581,1736566331,1736856753; HMACCOUNT=5425913DBB2FC92E; Hm_lpvt_f6e61cf1824cdc5229627cb4f977c9b7=1736856758
Host: www.dpxq.com
Pragma: no-cache
Referer: http://www.dpxq.com/hldcg/search/view_m_18217.html
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
设置各项以后,可以点击右下角的【Scripts】查看生成的VB代码:
也可以单击【Send】按钮得到请求到的htm源代码。
此外,还有一个URLEncode、Decode的小工具。
注意,如果选择WinhttpRequest,中间的Setoption区域可用。如果选择POST请求方式,中间的data区域可用。
GET /hldcg/search/DhtmlXQ_www_dpxq_com.htm HTTP/1.1 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-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cache-Control: no-cache Connection: keep-alive Cookie: ASPSESSIONIDQADRRBQR=LJNCKPOBDMPNKIALGJIAPBCB; Hm_lvt_f6e61cf1824cdc5229627cb4f977c9b7=1736226040,1736516581,1736566331,1736856753; HMACCOUNT=5425913DBB2FC92E; Hm_lpvt_f6e61cf1824cdc5229627cb4f977c9b7=1736856758 Host: www.dpxq.com Pragma: no-cache Referer: http://www.dpxq.com/hldcg/search/view_m_18217.html Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 控制台 AI 助理 新变化 Highlights from the Chrome 131 update 标签:application,www,XMLHTTP,WinhttpRequest,image,Accept,dpxq,WebRequestHelper,com From: https://www.cnblogs.com/ryueifu-VBA/p/18671536