手机携号转网查询接口 API检测丨识别,手机号码归属地及运营商查询接口

 携号转网实时手机号归属地及运营商查询接口API

可以使用以下http地址免费测试(请求号码需更换):

点击进行测试


携号转网的基本概念: 

携号转网,也称作号码携带、移机不改号,也就是说一家电信运营商的用户,无需改变自己的手机号码,就能转而成为另一家电信运营商的用户,并享受其提供的各种服务。

携号转网的应用及对第三方运营商的痛点:

基于用户携号转网后,第三方运营者原有数据标签未及时更新,导致业务操作上的失败,如短信接收失败,号码充值失败等多个应用场景。据不完全统计目前携号转网用户约占全网用户的1%,携号转网的查询应用于互联网金融、担保、法律、旅游、保险、电商、人力资源、租赁等各类有需求的政府、企业等机构以及风控审核和信用评定环节。

携号转网接口: 

携号转网接口对外开放http接口方式,系统直连于三大运营商实时返回查询结果,非缓存库,非本地数据库数据返回,准确率99.99%,用户通过手机号的传入即可查询该号码是否携号转网,返回结果具体有实时性、准确性等特点。

携号转网接口响应速度快,接口支持单条毫秒级快速返回结果,同时也支持批量级

快速查询,单条压测响应回包时间基本在 100 毫秒内,批量一次性查询 1000 条,压测时

长在 1500ms 即 1.5 秒左右。

以下为客户单条压力测试时的 delphi 数据截图日志:

以下为客户批量压力测试时的 python 数据截图日志:

接口编码方式采用统一的 UTF-8,请求方式采用 HTTP REST,单条支持 GET/POST

方式进行请求,批量多条提交的方式限 POST。

提供 http 和 https 调用类型。


java-请求示例:
​
public static void main(String[] args) {
	    String host = "https://xhzw.market.alicloudapi.com";
	    String path = "/isp";
	    String method = "POST";
	    String appcode = "你自己的AppCode";
	    Map<String, String> headers = new HashMap<String, String>();
	    //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
	    headers.put("Authorization", "APPCODE " + appcode);
	    Map<String, String> querys = new HashMap<String, String>();
	    querys.put("mobile", "mobile");
	    String bodys = "";
 
 
	    try {
	    	/**
	    	* 重要提示如下:
	    	* HttpUtils请从
	    	* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
	    	* 下载
	    	*
	    	* 相应的依赖请参照
	    	* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
	    	*/
	    	HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
	    	System.out.println(response.toString());
	    	//获取response的body
	    	//System.out.println(EntityUtils.toString(response.getEntity()));
	    } catch (Exception e) {
	    	e.printStackTrace();
	    }
	}

​
C#-请求示例:
​
//using System.IO;
//using System.Text;
//using System.Net;
//using System.Net.Security;
//using System.Security.Cryptography.X509Certificates;
 
        private const String host = "https://xhzw.market.alicloudapi.com";
        private const String path = "/isp";
        private const String method = "POST";
        private const String appcode = "你自己的AppCode";
 
        static void Main(string[] args)
        {
            String querys = "mobile=mobile";
            String bodys = "";
            String url = host + path;
            HttpWebRequest httpRequest = null;
            HttpWebResponse httpResponse = null;
 
            if (0 < querys.Length)
            {
                url = url + "?" + querys;
            }
 
            if (host.Contains("https://"))
            {
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
                httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
            }
            else
            {
                httpRequest = (HttpWebRequest)WebRequest.Create(url);
            }
            httpRequest.Method = method;
            httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
            if (0 < bodys.Length)
            {
                byte[] data = Encoding.UTF8.GetBytes(bodys);
                using (Stream stream = httpRequest.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }
            }
            try
            {
                httpResponse = (HttpWebResponse)httpRequest.GetResponse();
            }
            catch (WebException ex)
            {
                httpResponse = (HttpWebResponse)ex.Response;
            }
 
            Console.WriteLine(httpResponse.StatusCode);
            Console.WriteLine(httpResponse.Method);
            Console.WriteLine(httpResponse.Headers);
            Stream st = httpResponse.GetResponseStream();
            StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
            Console.WriteLine(reader.ReadToEnd());
            Console.WriteLine("\n");
 
        }
 
        public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            return true;
        }

​
PHP-请求示例:
​
<php
    $host = "https://xhzw.market.alicloudapi.com";
    $path = "/isp";
    $method = "POST";
    $appcode = "你自己的AppCode";
    $headers = array();
    array_push($headers, "Authorization:APPCODE " . $appcode);
    $querys = "mobile=mobile";
    $bodys = "";
    $url = $host . $path . "?" . $querys;
 
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    if (1 == strpos("$".$host, "https://"))
    {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    }
    var_dump(curl_exec($curl));
>

​
Python-请求示例:
​
import urllib, urllib2, sys
import ssl
 
 
host = 'https://xhzw.market.alicloudapi.com'
path = '/isp'
method = 'POST'
appcode = '你自己的AppCode'
querys = 'mobile=mobile'
bodys = {}
url = host + path + '?' + querys
 
request = urllib2.Request(url)
request.add_header('Authorization', 'APPCODE ' + appcode)
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
    print(content)

​

正常返回示例:

​
{
     code:  0,                        //code 返回0表示本次查询成功
     reason: "Succ",                  //reason 返回详细的请求状态说明码
     result: {
         res: "1",                    //res 是否转网,0,未转网,1,已转网(明确已转网),如返回3或4则为虚拟运营商
         Mobile: "13972565391",       //查询的手机号码
         Area: "广东-深圳",           //号码归属地,格式为:省-市
         Init_isp: "移动",            //最初归属的运营商
         Now_isp: "电信"              //转网后的运营商,如果未转网,则同Init_isp一致
         }
}

​

失败返回示例:

​
{
    code: "-8",                       //code 返回非0的数字表示api查询失败,具体的原因见错误码配置
    reason: "系统错误,或稍候再试"     //reason 返回详细的请求状态说明码  
}

​

提供接口的同时也向用户开放web管理查询界面,请与管理员索取。

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值