ResponseHeaders

对单独的响应标头赋予访问权限的标头对象。

语法

HTTPObject.ResponseHeaders

其中:

  • ResponseHeaders 是对象(读)
示例

此脚本将打印出 HTTP 服务器的名称:

函数 Main

Dim HTTPObj as Object

Dim headers as Object

ip = "www.apache.org"

port = 80

cr = Chr(13) + Chr(10)

Set HTTPobj = HTTP.Connect (ip,port)

'设置请求类型

HTTPobj.GetURL("/")

HTTPobj.verb = "HEAD"

'使用自动身份验证通过代理

'身份验证必须设置为 1

HTTPobj.Authentication = 1

'发送 HEAD 请求

HTTPResponse = HTTPobj.SendRequest ()

'设置新的标头对象

Set headers = HTTPobj.ResponseHeaders

'HTTPResponse 包含返回码

echo "Result: " + cstr(HTTPResponse) + cr

'http 结果类似以下所示:

'HTTP/1.1 200 OK

'服务器: Microsoft-IIS/5.0

'日期: Tue, 28 Oct 2003 10:23:19 GMT

'内容长度: 1270

'内容类型:文本/html

echo "Server running on " + ip + " is " + headers.HeaderValue("server") + cr

End 函数