Discussion:
Script to output single HTTP GET ?
(too old to reply)
Vilius Mockûnas
2009-10-07 04:54:37 UTC
Permalink
Hello,

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
David H. Lipman
2009-10-07 10:18:07 UTC
Permalink
From: "Vilius Mockûnas" <***@yahoo.com>

| Hello,

| 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


Why not incorporate a shell to the GNU WGET utility ?
--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp
Tom Lavedas
2009-10-07 11:49:07 UTC
Permalink
Post by Vilius Mockûnas
Hello,
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
Anteaus
2009-10-07 12:55:01 UTC
Permalink
Method using COM:

Function HTTPGet(URL)
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 0
IE.navigate URL
do while IE.Busy
loop
HTTPGet = IE.document.documentelement.outerhtml
IE.quit
Set IE = Nothing
End Function

Or, a better approach, use AutoIt's InetGet() function.

http://autoitscript.com
Post by Vilius Mockûnas
Hello,
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
mayayana
2009-10-07 14:08:23 UTC
Permalink
In addition to the other answers provided, if
you want to do it more directly see here:

www.jsware.net/jsware/scripts.php5#jshttp

The XML method shown by Tom Lavedas is
easier (assuming that you don't have ADODB
disabled/removed).
This download more like a scriptable interface
for the Windows sockets API. It lets you handle
the server "conversation" directly.
Post by Vilius Mockûnas
Hello,
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
Loading...