使用autojs如何让post请求的数据不走VPN和代理
在使用Auto.js发送POST请求时,可以通过设置请求头来控制数据不走VPN和代理。具体步骤如下:
- 导入需要的模块:
var http = require("http");
var config = require("net").HttpConfig;
- 在发送POST请求之前,设置请求头的
vpn和proxy字段为false:
config.vpn = false;
config.proxy = false;
- 发送POST请求:
http.post({
url: "http://example.com/api",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
key1: "value1",
key2: "value2"
})
}, function (res) {
var result = res.body.string();
console.log(result);
});
以上代码中,http.post方法用于发送POST请求,headers字段中设置了请求头的Content-Type为application/json,body字段中设置了POST请求的数据。
通过设置请求头的vpn和proxy字段为false,可以确保请求不走VPN和代理。
请注意,以上代码仅为示例,具体的URL和请求参数需要根据实际情况进行修改
原文地址: https://www.cveoy.top/t/topic/inUm 著作权归作者所有。请勿转载和采集!