端口

设置或检索要连接的 HTTP 服务器的端口。

语法

HTTPObject.Port

其中:

  • Port 是字符串(读/写)
示例

该脚本将重复使用同一个对象连接不同的端口并发送同一个请求:

函数 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("/")

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

'身份验证必须设置为 1

HTTPobj.Authentication = 1

'发送 GET 请求

HTTPResponse1 = HTTPobj.SendRequest ()

HTTPobj.PORT = port2

HTTPResponse2 = HTTPobj.SendRequest ()

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

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

End 函数