VBScript, sending GET request.
- Created on Wednesday, 08 September 2010 23:32
- Last Updated on Friday, 11 October 2013 06:15
EDIT. I've made a few changes on 3 DEC 2012.
Sometimes VBscript just runs like crazy waiting for IE. even though the request has been sent fine.
I spent a few hours looking for a way to send a GET request.
There's plenty of these out there:
Set http = CreateObject("Microsoft.XmlHttp")
And stuff with msxml, msxml2, msxml.hmlhttpserver, msmxl2.xmlsmlxmslmslsmslrequestgetsmslwllxl and all the others.
Problem is what version will be on the windows machines you deploy it to? there are no less than a shitload of versions.
Between service packs, patches, and special versions you may/may not have installed....
I found this works more often than not:
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 0
IE.navigate "http://example.com/parser.php?key=" & value & "key2=" & value2
Do While IE.Busy
WScript.Sleep 200 ' see the above notice of change
Exit Do ' prevents script host from going crazy waiting for IE
HTTPGet = IE.document.documentelement.outerhtml
Set IE = Nothing
'WScript.Echo HTTPGet 'good for debugging. shows what you got back.
If this article was at least a little helpful, how about a +1?