/**
* 测试执行:node ./test.js
*/
var http = require('http')
function post(hostname, path, json_data, callback){
var options = {
hostname: hostname,
port: 80,
path: path,
method: 'POST',
headers: {
'Content-Type':'application/json',
'Date':'Tue, 26 Aug 2025 07:14:23 GMT', // 请替换为当前的GMT时间
'Authorization':'Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //请替换为您的鉴权签名
}
}
var req = http.request(options, function(res){
var body ="";
res.setEncoding('utf8');
res.on('data', function(chunk){
//console.log(chunk.toString());
body += chunk;
});
res.on('end', function(){
var json = JSON.parse(body);
callback(json)
});
});
req.on('error', function(e){
console.log('msg:'+e.message);
});
req.write(json_data);
req.end();
}
var hostname = "api.ihuyi.com";
var request_uri = "/empty-number/submit";
//定义请求的数据
var values = {
"mobiles":["135xxxxxxxx","136xxxxxxxx"], //手机号数组(最多10个)
}
var json_data = JSON.stringify(values);
//发起请求
post(hostname, request_uri, json_data, function(json){
//打印结果
console.log(json);
})
在线咨询
150,000家
企业客户
21年
行业经验
2V1
2对1客户支持