Count

返回 HTTPHeaders 对象中的标头条目数。

语法

HTTPHeadersObject.Count

其中:

  • Count 是长整型(读)
示例

该脚本将打印标头:

函数 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 函数