跳到主要内容
版本:v6.5.0

发送HTTP请求

命令说明

HTTP.Request 发送HTTP请求

命令原型

sRet = HTTP.Request(method, url, body_type, body, headers, cookies, cert, timeout)

命令参数

参数必选类型默认值说明
methodTruestring""HTTP请求方法
urlTruestring""请求URL
body_typeFalsestring""请求体类型
bodyFalseexpression{}请求体数据
headersFalseexpression{}请求头
cookiesFalseexpression{}请求cookie
certFalseexpression{}客户端证书,字典类型,cert_path和key都为空则忽略认证,如果无秘钥key可以不填
timeoutFalsenumber60000超时时间(毫秒)

返回结果

sRet,将命令运行后的结果赋值给此变量。

运行实例

/*********************************发送HTTP请求************************************
命令原型:
sRet = HTTP.Request(method, url, body_type, body, headers, cookies, cert, timeout)
入参:
method--HTTP请求方法。注:GET、POST、PUT、DELETE、HEAD、OPTIONS、TRACE、CONNECT
url--请求URL。注:请求URL
body_type--请求体类型。注:可选值为:json、form、form-data、text、html、xml、binary
body--请求体数据。
headers--请求头。
cookies--请求cookie。
cert--客户端证书。
timeout--超时时间(毫秒)。
出参:
sRet--函数调用的输出保存到的变量。
注意事项:

********************************************************************************/
Dim sRet = ""
sRet = HTTP.Request("GET", "https://www.baidu.com", "", "", {}, {}, "", 60000)
TracePrint(sRet)