短信签名快速报备,马上注册寻求客户经理支持!
所有文档
运营商信息核验
文档中心 > 运营商信息核验 > 空号检测

空号检测

Node.js对接空号检测提交接口接口DEMO示例
本文为您提供了Node.js语言版本的空号检测提交接口接口对接DEMO示例

/**
* 测试执行: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);
})

在线咨询
服务热线:
4008 808 898

免费体验

提交成功
若短信发送异常,系统将自动给您发送语音验证码,请注意接听电话。

填写验证码后,点击“开通体验账户”自动开通体验账户。

收不到短信验证码?
×