All pastes #165336 Raw Edit

yegs

public text v1 · immutable
·published 2006-09-09 19:35 UTC
rendered paste body
Option Explicit

' === Variables ===
Dim lngArgCount, strURL, objHTTP, strHTML

' === Script ===
lngArgCount = WScript.Arguments.Count

If lngArgCount <> 1 Then
  Call Wscript.Echo("Usage: LoadURL.vbs <url>")
  Call Wscript.Quit()
End If

' getting url from command line arguments
strURL = WScript.Arguments.Item(0)

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
Call objHTTP.setTimeouts(2000, 2000, 2000, (30 * 60 * 1000))
Call objHTTP.open("GET", strURL, False)
Call objHTTP.send()
If objHTTP.status <> 200 Then
  ' handle errors
Else
  strHTML = objHTTP.responseText
  ' do stuff here with the html
End If

' === Cleanup ===
Set objHTTP = Nothing