Quicklinks
ActiveSocket provides an easy-to-use development interface to a variety of IP protocols. By using ActiveSocket, you can very easily create or enhance applications with network features.
ActiveSocket features the following: ICMP, HTTP and HTTPs with support for proxy servers and secure web sites, Telnet, NTP time protocol, RSH remote shell script interface, SNMP (Simple Network Management Protcol), SNMP Traps, Sockets, WOL (Wake-On-LAN), and more.
HTTP Get and HTTP Post can be well integrated into ASP environments. This document describes how the ActiveSocket Http object can be integrated into ASP projects.
The most important functions of the Http object are:
When sending an HTTP request to a webserver, the webserver first responds with an HTTP header, followed by the HTML data. This header can contain information about the webserver, client, cookies or proxy information. These values can be retrieved using the 'ReadHeader' method of the Http interface.
The following lines of code demonstrate how to read some header values:
Option Explicit
Dim objHttp
Set objHttp = CreateObject ( "ActiveXperts.Http" )
objHttp.Connect "http://www.activexperts.com"
If ( objHttp.LastError <> 0 ) Then
WScript.Echo "Failed to load website: ERROR #" & objHttp.LastError & " (" & objHttp.GetErrorDescription ( objHttp.LastError )
WScript.Quit
End If
WScript.Echo objHttp.ReadHeader ( 37 )
objHttp.Disconnect
The samples connects to the webserver 'www.activexperts.com' and retrieves the server software version. You can find an overview of all HTTP headers and the associated ID's to be used in the 'ReadHeader' method below.
| Accept | 24 | List of MIME types supported by the client |
| Accept-Charset | 25 | List of charsets supported by the client |
| Accept-Encoding | 26 | List of encodings supported by the client |
| Age | 48 | The amount of time since the document was generated by the server |
| Authorization | 28 | Authorization credentials request |
| Content-Description | 4 | Description of the content |
| Content-Encoding | 29 | Indicates what additional content codings have been applied to the content |
| Content-Id | 3 | Content identification |
| Content-Length | 5 | Length of the content that follows |
| Content-Location | 51 | Location of the content |
| Content-MD5 | 52 | MD5 Digest of the content |
| Content-Type | 1 | Content-Type of the document |
| Cookie | 44 | Cookie send by the client, ifthe client has received a cookie from this website before |
| Date | 9 | Date and time the content was generated on the webserver |
| Etag | 54 | Entity tag, used when the content is available on multiple locations |
| Host | 55 | Internet host and port number of the resource being requested |
| If-Modified-Since | 32 | Last time the content has been modified |
| Location | 33 | The current URL |
| Proxy-Authenticate | 41 | Authentication scheme returned by the proxy |
| Proxy-Authorization | 61 | Header that is used to identify the user to a proxy that requires authentication |
| Range | 62 | Can be used to download only a part of the content |
| Raw-Headers | 21 | All header returned by the server, separated by 0 bytes |
| Raw-Headers-CRLF | 22 | All headers returned by the server, separated by carriagereturn - linefeed bytes |
| Referer | 35 | URL of the page that linked to the current page |
| Request-Method | 45 | Request verb that was used, GET or POST |
| Retry-After | 36 | Time returned by the server, the estimated time to generate the response. |
| Server | 37 | Returns the name and version of the server software |
| Set-Cookie | 43 | Cookie received from the server |
| Status-Code | 19 | Status code returned by the server |
| Status-Text | 20 | Additional response text returned by the server |
| Transfer-Encoding | 63 | Indicates the type of transformation that has been applied on the content to transfer it to the client |
| User-Agent | 39 | Name and version of the client software |
| Version | 18 | HTTP Version of the current session (HTTP 1.0 or HTTP 1.1) |
| Via | 66 | Intermediate protocols used between the client and server, set when a proxy server is used |
| Warning | 67 | Additional information about the last request |
| WWW-Authenticate | 40 | Authetication schemes supported by the server |