Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. With CreateObject("MSXML2.xmlHttp")
  2. .Open "GET", "xxxxxxxxxxxxxxxxx", False
  3. .send
  4. resp = .responseText
  5. End With
  6.  
  7. With CreateObject("MSXML2.xmlHttp")
  8. .Open "GET", "xxxxxxxxxxxxxxxxx", False
  9. .send
  10. resp = .responseText
  11. End With
  12.  
  13. Dim WinHttpReq As Object, attempts As Integer
  14. attempts = 3
  15. On Error GoTo TryAgain
  16. TryAgain:
  17. attempts = attempts - 1
  18. Err.Clear
  19. If attempts > 0 Then
  20. Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
  21. WinHttpReq.Open "GET", url, False
  22. WinHttpReq.send
  23. If WinHttpReq.Status = 200 Then
  24. Set oStream = CreateObject("ADODB.Stream")
  25. oStream.Open
  26. oStream.Type = 1
  27. oStream.Write WinHttpReq.responseBody
  28. oStream.SaveToFile filePath, 2 ' 1 = no overwrite, 2 = overwrite
  29. oStream.Close
  30. End If
  31. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement