/**
* 測試執(zhí)行: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', // 請?zhí)鎿Q為當(dāng)前的GMT時間
'Authorization':'Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //請?zhí)鎿Q為您的鑒權(quán)簽名
}
}
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";
//定義請求的數(shù)據(jù)
var values = {
"mobiles":["135xxxxxxxx","136xxxxxxxx"], //手機號數(shù)組(最多10個)
}
var json_data = JSON.stringify(values);
//發(fā)起請求
post(hostname, request_uri, json_data, function(json){
//打印結(jié)果
console.log(json);
})
國內(nèi)專業(yè)互聯(lián)網(wǎng)團(tuán)隊
21年行業(yè)經(jīng)驗
7x24小時售后支持
豐富的行業(yè)經(jīng)驗
Copyright ? 2004-2025 上海思銳信息技術(shù)有限公司 All rights reserved. 滬ICP備07035915號-15 電信增值業(yè)務(wù)許可證:B2-20160082
服務(wù)熱線:
4008 808 898
服務(wù)熱線(工作時間):
4008 808 898
業(yè)務(wù)咨詢(非工作時間):
售后咨詢(非工作時間):