|
-用fiddler进行了抓包,不过出现一个问题,针对抓包结果在vba进行调用xmlhttp发包,结果发出来的包格式不对。无法正常使用。请教下各位。
---1抓包结果
POST http://XXX.XX.XX.XXX:XXX/webapp/ ... p;method=inserToken HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: zh-cn
Referer: http:// XXX.XX.XX.XXX:XXX/webapp/gsyytz/ProvinceAddressAction.do?state=getProvinceAddressFrame&displayMenuAndFooter=false
Accept: text/javascript, text/html, application/xml, text/xml, */*
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; InfoPath.3)
Host: XXX.XX.XX.XXX:XXX
Content-Length: 12
Connection: Keep-Alive
Pragma: no-cache
Cookie: domainID=0; domainName=; SzrsCookie=fj3FMXLgda7jYXcvBbPfqN5OAhBbqKE-vYIz57GwfMaRGrYj9KwY!1630039042
arguments=[]
---VBA模拟发包结果
POST http://XXX.XX.XX.XXX:XXX/webapp/ ... p;method=inserToken HTTP/1.1
Accept: text/javascript, text/html, application/xml, text/xml, */*
Accept-Language: zh-cn
Referer: http:// XXX.XX.XX.XXX:XXX/webapp/gsyytz/ProvinceAddressAction.do?state=getProvinceAddressFrame&displayMenuAndFooter=false
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Accept-Encoding: gzip, deflate
Host: XXX.XX.XX.XXX:XXX
Content-Length: 13
Connection: Keep-Alive
Pragma: no-cache
Cookie: domainID=0; domainName=; SzrsCookie=8-rFziWnaGbfHbvZCXy_dVZ9kB2mGkTBOmmxe9OtabkUqrAROV6s!1630039042
arguments =[]
---
——模拟访问语句
Sub test23()
Dim url, url2 As String
url = "http:// XXX.XX.XX.XXX:XXX /webapp/gsyytz/ProvinceAddressAction.do?state=getProvinceAddressFrame&displayMenuAndFooter=false"
url2 = "http:// XXX.XX.XX.XXX:XXX /webapp/xhr/remoteCall?service=provinceAddressService&method=inserToken"
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, False
.send
' Debug.Print .Getallresponseheaders
Debug.Print .responsetext
.Open "POST", url2, False
.setrequestheader "referer", url
.setrequestheader "x-requested-with", "XMLHttpRequest"
.setrequestheader "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"
.setrequestheader "Accept", "text/javascript, text/html, application/xml, text/xml, */*"
.setrequestheader "Content-Length", "12"
.setrequestheader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; InfoPath.3)"
' .setrequestheader "Cookie", "domainID=0; domainName=; "
.send "arguments =" & Chr(91) & Chr(93) '
' Debug.Print .Getallresponseheaders
' Debug.Print .responsetext
End With
End Sub
|
|