HeaderName

HeaderName 用于检索 HTTPHeader 对象的标头名称。

语法

HeaderName (LONG index)

介于 0 到标头数之间的有效索引范围

返回结果

包含标头名称的字符串。

示例

该脚本将打印标头:

函数 Main

Dim HTTPObj as Object

Dim headers as Object

ip = "www.gfi.com"

port = 80

cr = Chr(13) + Chr(10)

Set HTTPobj = HTTP.Connect (ip,port)

'设置请求类型

HTTPobj.GetURL("/")

HTTPobj.verb = "HEAD"

'发送 HEAD 请求

HTTPResponse = HTTPobj.SendRequest ()

'设置新的标头对象

Set headers = HTTPobj.ResponseHeaders

'headers.count 包含标头的数量(长)

echo "header count: " & CStr(headers.Count) & cr

upbound = headers.Count - 1

'对于每个标头,回显标头名称和标头值

For hn=0 To upbound

echo headers.HeaderName(hn) & vbTab & "-->" & vbtab & headers.HeaderValue(hn) & cr

下一步

End 函数