|
你好,我想问一下,抓取网页时,把FIDDLER打开vba能够通过XMLHTTP抓取到数据,把FIDDLER关闭了SEND就出现自动化错误,不知道怎么解决.就是红色部分出错
Sub Main()
Const username As String = ""
Const password As String = ""
Dim strText As String
Dim uid As String
Set HttpReq = CreateObject("MSXML2.XMLHTTP.3.0")
With CreateObject("MSXML2.XMLHTTP")
.Open "POST", "XXXXX ", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Accept-Language", "zh-cn"
.setRequestHeader "Accept-Encoding", "gzip, deflate"
.Send "loginName=" & username & "&password=" & password & "&R1=v4"
strText = .getallresponseheaders
Debug.Print strText
' .Open "GET", "https://zfzx.clo.com.cn/reporting/left.do ", False
' .send
' strText = .getallresponseheaders
' Debug.Print strText
' .Open "GET", "https://zfzx.clo.com.cn/reporting/main.do ", False
' .send
' strText = .responsetext
' Debug.Print strText
.Open "POST", "https://zfzx.clo.com.cn/reporting/main.do ", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.Send "thisDate=5&start_date=2019-2-2&startButt=%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F&end_date=2019-2-2&endButt=%E9%80%89%E6%8B%A9%E6%97%A5%E6%9C%9F&setdate=%2C&SelectArea=m13bnb00&report=%E9%94%80%E5%94%AE%E7%BB%9F%E8%AE%A1%E8%A1%A8&jikai=%E6%89%80%E6%9C%89%E7%8E%A9%E6%B3%95"
strText = .responsetext
Debug.Print strText
CopyToClipbox strText
Cells.Clear
Range("a11").Select
ActiveSheet.Paste
End With
End Sub
|
|