HeaderName
HeaderName 用於擷取 HTTPHeader 物件的標頭名稱。
語法
HeaderName (LONG index)
介於 0 到標頭數之間的有效索引範圍
結果
包含標頭名稱的字串。
範例
該指令碼將列印標頭:
Function 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 "標題計數: " & CStr(headers.Count) & cr
upbound = headers.Count - 1
'對於每個標頭,回應標頭名稱和標頭值
For hn=0 To upbound
echo headers.HeaderName(hn) & vbTab & "-->" & vbtab & headers.HeaderValue(hn) & cr
下一步
End Function