I got tired of waiting for MSDN as a reference to using the WinHttp ActiveXObject, so I'm transcribing things here. Visit MSDN's WinHttpRequest Object Reference for the original content.

WinHttp.WinHttpRequest.5.1

Methods of WinHttp

Properties of WinHttp

Events of WinHttp


WinHttp Methods

GetResponseHeader

The GetResponseHeader method gets the HTTP response headers.
Return Value = GetResponseHeader( *bstrHeader )
* = Required

Syntax

Remarks

Invoke this method only after the Send method has been called.

Example

The following code example shows how to open an HTTP connection, send an HTTP request, and get the date header from the response.
 // Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Initialize an HTTP request.
WinHttpReq.Open("GET",
                "http://www.microsoft.com",
                 false);

// Send the HTTP request.
WinHttpReq.Send();

// Display the date header.
WScript.Echo( WinHttpReq.GetResponseHeader("Date"));

Open

The Open method opens an HTTP connection to an HTTP resource.

Syntax

Open( *bstrMethod, *bstrUrl, varAsync = false )
* = Required.

Remarks

This method opens a connection to the resource identified in bstrUrl using the HTTP verb given in bstrMethod.

Example Code

The following code example shows how to open an HTTP connection, send an HTTP request, and read the response text.
// Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Initialize an HTTP request.
WinHttpReq.Open("GET", "http://www.microsoft.com", false);

// Send the HTTP request.
WinHttpReq.Send();

// Display the response text.
WScript.Echo( WinHttpReq.ResponseText);

Send()

Syntax

The Send method sends an HTTP request to an HTTP server.
Send( varBody )

Remarks

The request to be sent was defined in a prior call to the Open method. The calling application can provide data to be sent to the server through the varBody parameter. If the HTTP verb of the object's Open is "GET", this method sends the request without varBody, even if it is provided by the calling application.

Example Code

The following example shows how to open an HTTP connection, send an HTTP request, and read the response text.
// Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Initialize an HTTP request.
WinHttpReq.Open("GET", "http://www.microsoft.com", false);

// Send the HTTP request.
WinHttpReq.Send();

// Display the response text.
WScript.Echo( WinHttpReq.ResponseText);

The following example shows how to post data to an HTTP server.

 // Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Initialize an HTTP request.
WinHttpReq.Open("PUT", "http://postserver/newdoc.htm", false);

// Post data to the HTTP server.
WinHttpReq.Send("Post data");

SetTimeouts

The SetTimeouts method specifies the individual time-out components of a send/receive operation, in milliseconds.

Syntax

SetTimeouts( ResolveTimeout, ConnectTimeout, SendTimeout, ReceiveTimeout )

Remarks

All parameters are required. A value of 0 or -1 sets a time-out to wait infinitely. A value greater than 0 sets the time-out value in milliseconds. For example, 30,000 would set the time-out to 30 seconds. All negative values other than -1 cause this method to fail.

Time-out values are applied at the Winsock layer.

Example

The following example shows how to set all WinHTTP time-outs to 30 seconds, open an HTTP connection, and send an HTTP request.
// Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Set time-outs. If time-outs are set, they must
// be set before open.
WinHttpReq.SetTimeouts(30000, 30000, 30000, 30000);

// Initialize an HTTP request.
WinHttpReq.Open("GET", "http://www.microsoft.com", false);

// Send the HTTP request.
WinHttpReq.Send();

WaitForResponse()

The WaitForResponse method waits for an asynchronous Send method to complete, with optional time-out value, in seconds.

Syntax

Return Value = WaitForResponse( Timeout = -1)

Remarks

This method suspends execution while waiting for a response to an asynchronous request. This method should be called after a Send. Calling applications can specify an optional Timeout value, in seconds. If this method times out, the request is not aborted. This way, the calling application can continue to wait for the request, if desired, in a subsequent call to this method.

Calling this property after a synchronous Send method returns immediately and has no effect.

Example Code

This example shows how to open an asynchronous HTTP connection, send an HTTP request, wait for a response, and read the response text.
 // Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

// Initialize an HTTP request.
WinHttpReq.Open("GET", "http://www.microsoft.com", true);

// Send the HTTP request.
WinHttpReq.Send();

// Wait for the response.
WinHttpReq.WaitForResponse();

// Display the response text.
WScript.Echo( WinHttpReq.ResponseText);

WinHttp Properties


WinHttp Events