COM Component: AspHTTP: Using AspHTTP on Your Website

About AspHTTP

AspHTTP allows you to GET/POST/HEAD documents using the HTTP protocol. Key features include:

  • GET, HEAD and POST request methods
  • Response headers are exposed
  • Accept headers are modifiable
  • Adjustable timeout
  • Proxy support
  • Custom User-Agent headers
  • Custom Content-Type headers for POST
  • Redirection
  • Supports authentication areas
  • Retrieves URLs to a file including binary files
  • Allows custom HTTP request headers

Sample AspHTTP Code

Using the component is as simple as:

  • Creating the object
  • Setting a single property
  • Calling the GetURL method

The following code demonstrates how to use AspHTTP from VBScript.

Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://www.myfinancialpage.com/qrtresults.html"
strResult = HTTPObj.GetURL

The variable strResult now contains a string representing the document results from a GET of http://www.myfinancialpage.com/qrtresults.html.

POSTing Data

AspHTTP allows you to post data back to the Web server. The following example demonstrates a POST request:

Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://www.myfinancialpage.com/scripts/update3.asp"
HTTPObj.PostData = "suid=jimb&pwd=macabre&id=32&val=1.5"
HTTPObj.RequestMethod = "POST"
strResult = HTTPObj.GetURL

The variable named strResult now contains a string representing the document results from a POST to

http://www.myfinancialpage.com/scripts/update3.asp.

For full documentation and more examples of using AspHTTP, please visit Serverobjects.com

Add Feedback