Post by Vilius MockûnasHello,
I'm looking a way to execute single http GET request using vbscript.
The script will be run in wsh not in ASP.
thanks
Vilius
Need a little more information. What is to be accomplished with the
Get? Display the resulting page? Save the response? Is the expected
response primarily text (HTNL) or binary (image)?
The common method of issuing a GET from script is to access the
scriptable MSXML.XMLHTTP class, something like the routine below,
which uses a Get to retrieve and save an arbitrary URL (works for text
or binary) to the named file.
' Source Michael Harris & Alex K. Angelopoulos
' modified by TGL May 2003
' http://groups.google.com/groups?selm=OxJBkB8xCHA.2120%40TK2MSFTNGP11
&
' http://www.google.com/groups?selm=%23v1%23CmirAHA.2132%40tkmsftngp05
Sub DownBinFile(FilePath, sURL)
Const adTypeBinary = 1, adModeReadWrite = 3, adSaveCreateOverwrite =
2
' Create an xmlhttp object:
set oXML = CreateObject("MSXML2.XMLHTTP")
oXML.open "GET", sURL, False
oXML.send
With CreateObject("ADODB.Stream")
.type = adTypeBinary
.mode = adModeReadWrite
.open
Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop
.write oXML.responseBody
.savetofile FilePath, adSaveCreateOverwrite
End With
End Sub
Is that what you wanted? If not, please explain.
_____________________
Tom Lavedas