TechHelpList.com

  • Increase font size
  • Default font size
  • Decrease font size

By A Web Design

Home Tech Tutorials Windows, AD, Win Scripting VBScript, sending GET request.

VBScript, sending GET request.

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....

http://support.microsoft.com/kb/269238

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
loop
HTTPGet = IE.document.documentelement.outerhtml
IE.quit
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?

 

 

Comments  

 
+3 #1 heroki 2012-02-24 18:22
pretty cool. thx.
Quote
 

Add comment


Security code
Refresh