Connect

Connect is used to set the hostname or IP address and the port of the HTTP server in the Object.

Syntax

HTTP.Connect (STRING hostname, LONG port)

Where:

  • Hostname - can be the IP address or the hostname (example: 192.168.11.11 or www.gfi.com)
  • Port – an Integer between 1 and 65535
Returns

HTTP Object.

Example

This script will do a GET request and print out the return code:

Function Main

Dim HTTPObj as Object

ip = "www.gfi.com"

port = 80

Set HTTPobj = HTTP.Connect (ip,port)

'set up the request type

HTTPobj.GetURL("/")

' to pass through the proxy with automatic authentication

' Authentication needs to be set to 1

HTTPobj.Authentication = 1

' Send the GET request

HTTPResponse = HTTPobj.SendRequest ()

echo "Result: " + cstr(HTTPResponse)

End Function