HeaderValue
HeaderValue retrieves the value of the Header from the HTTPHeaders Object.
Syntax
HeaderValue (VARIANT index)
Where:
Index
is a string or long value- String value will be used if you want to retrieve a value when given the header name (example:
Server
). HeaderValue can also be retrieved given an index. The valid range for this index is between 0 and the number of headers.
Returns
A String containing the value of the header.
Example
This script will print out the name of the HTTP server:
Function Main
Dim HTTPObj as Object
Dim headers as Object
ip = "www.gfi.org"
port = 80
cr = Chr(13) + Chr(10)
Set HTTPobj = HTTP.Connect (ip,port)
'Set up the request type
HTTPobj.GetURL("/")
HTTPobj.verb = "HEAD"
'Send the HEAD request
HTTPResponse = HTTPobj.SendRequest ()
'Set new Object called headers
Set headers = HTTPobj.ResponseHeaders
'HTTPResponse contains the return code
echo "Result: " + cstr(HTTPResponse) + cr
echo "Server running on " + ip + " is " + headers.HeaderValue("server") + cr
End Function