|
还是没有攻克VBA怎样使用代理来下载,下没几页应给封IP了,谢谢!
Sub Main()
For ii = 1 To [a1]
Dim strFileName As String
strFileName = "C:\Downloads\" & [b1] & ii & ".jpg" '" & ii & "
With CreateObject("MSXML2.XMLHTTP") 'CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", "http://121.40.211.8/api/getservice?orgid=cdyxy&ObjId=m.20110919-SGD-888-0178.ft.cebx.1&UserName=cdyxy00010&MetaId=m.20110919-SGD-888-0178&cult=CN&dbsource=dlib&Time=2015-5-24 13:27:47&Sign=3BE1B075E9DFB43891568947B3C74E8E&Rights=1-0_00&width=1600&height=2400&page=" & ii & "&ServiceType=imagepage" & ii & "&ServiceType=imagepage", False
.Send
ByteToFile .responsebody, strFileName
End With
Next
End Sub
Sub ByteToFile(arrByte, strFileName As String)
With CreateObject("Adodb.Stream")
.Type = 1 'adTypeBinary
.Open
.Write arrByte
.SaveToFile strFileName, 2 'adSaveCreateOverWrite
.Close
End With
End Sub |
|