連接埠

設定或擷取要連線的 HTTP 伺服器的連接埠。

語法

HTTPObject.Port

其中:

  • Port 是字串(讀/寫)
範例

該指令碼將重複使用同一個物件連線到不同的連接埠並傳送同一個要求:

Function Main

Dim HTTPObj as Object

ip = "127.0.0.1"

port1 = 80

port2 = 81

cr = Chr(13) + Chr(10)

Set HTTPobj = HTTP.Connect (ip,port1)

'設定要求類型

HTTPobj.GetURL("/")

'經由自動驗證通過 Proxy

'驗證必須設為 1

HTTPobj.Authentication = 1

'傳送 GET 要求

HTTPResponse1 = HTTPobj.SendRequest ()

HTTPobj.PORT = port2

HTTPResponse2 = HTTPobj.SendRequest ()

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

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

End Function