ResponseHeaders

對單獨的響應標頭賦予存取權限的標頭物件。

語法

HTTPObject.ResponseHeaders

其中:

  • ResponseHeaders 是物件(讀)
範例

此指令碼將列印出 HTTP 伺服器的名稱:

Function 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"

'經由自動驗證通過 Proxy

'驗證必須設為 1

HTTPobj.Authentication = 1

'傳送 HEAD 要求

HTTPResponse = HTTPobj.SendRequest ()

'設定新的標頭物件

Set headers = HTTPobj.ResponseHeaders

'HTTPResponse 包含傳回碼

echo "結果: " + cstr(HTTPResponse) + cr

'http 結果類似以下所示:

'HTTP/1.1 200 OK

'伺服器: Microsoft-IIS/5.0

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

'內容長度: 1270

'內容類型:文字/html

echo "在 " + ip + " 上執行的伺服器為 " + headers.HeaderValue("server") + cr

End Function