Advertisement
Guest User

WGET.vbs

a guest
May 4th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. strUrl = WScript.Arguments.Item(0)
  2. StrFile = WScript.Arguments.Item(1)
  3. Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0
  4. Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0
  5. Const HTTPREQUEST_PROXYSETTING_DIRECT = 1
  6. Const HTTPREQUEST_PROXYSETTING_PROXY = 2
  7. Dim http, varByteArray, strData, strBuffer, lngCounter, fs, ts
  8. Err.Clear  
  9. Set http = Nothing
  10. Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
  11. If http Is Nothing Then Set http = CreateObject("WinHttp.WinHttpRequest")
  12. If http Is Nothing Then Set http = CreateObject("MSXML2.ServerXMLHTTP")  
  13. If http Is Nothing Then Set http = CreateObject("Microsoft.XMLHTTP")
  14. http.Open "GET", strURL, False  
  15. http.Send
  16. varByteArray = http.ResponseBody
  17. Set http = Nothing  
  18. Set fs = CreateObject("Scripting.FileSystemObject")
  19. Set ts = fs.CreateTextFile(StrFile, True)  
  20. strData = ""
  21. strBuffer = ""
  22. For lngCounter = 0 to UBound(varByteArray)
  23. ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1)))  
  24. Next  
  25. ts.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement