发送HTTP请求
命令说明
HTTP.Request 发送HTTP请求
命令原型
sRet = HTTP.Request(method, url, body_type, body, headers, cookies, cert, timeout)
命令参数
参数 | 必选 | 类型 | 默认值 | 说明 |
---|---|---|---|---|
method | True | string | "" | HTTP请求方法 |
url | True | string | "" | 请求URL |
body_type | False | string | "" | 请求体类型 |
body | False | expression | {} | 请求体数据 |
headers | False | expression | {} | 请求头 |
cookies | False | expression | {} | 请求cookie |
cert | False | expression | {} | 客户端证书,字典类型,cert_path和key都为空则忽略认证,如果无秘钥key可以不填 |
timeout | False | number | 60000 | 超时时间(毫秒) |
返回结果
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)