200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 携号转网查询接口API 手机号码归属地及运营商查询接口

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

时间:2020-02-25 02:50:47

相关推荐

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

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

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

/qxt_test?mobile=13972565391

携号转网的基本概念:

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

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

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

企讯通携号转网接口:

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

企讯通携号转网接口响应速度快,响应时间基本在10毫秒左右返回。

以下为压力测试时的数据日志:

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

提供http和https调用类型。

请求地址如下:

------------------------------------------------------------------------------

标准http 协议url地址: /

标准https协议url地址: /

------------------------------------------------------------------------------

java-请求示例:

public static void main(String[] args) {String host = "https://xhzw.";String path = "/isp";String method = "POST";String appcode = "你自己的AppCode";Map<String, String> headers = new HashMap<String, String>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105headers.put("Authorization", "APPCODE " + appcode);Map<String, String> querys = new HashMap<String, String>();querys.put("mobile", "mobile");String bodys = "";try {/*** 重要提示如下:* HttpUtils请从* /aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java* 下载** 相应的依赖请参照* /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 ;//using .Security;//using System.Security.Cryptography.X509Certificates;private const String host = "https://xhzw.";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.";$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, sysimport sslhost = 'https://xhzw.'path = '/isp'method = 'POST'appcode = '你自己的AppCode'querys = 'mobile=mobile'bodys = {}url = host + path + '?' + querysrequest = urllib2.Request(url)request.add_header('Authorization', 'APPCODE ' + appcode)ctx = ssl.create_default_context()ctx.check_hostname = Falsectx.verify_mode = ssl.CERT_NONEresponse = 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管理查询界面,请与管理员索取。

1、携号转网查询接口

用户的客户端向企讯通携号转网接口提交需要查询的号码

1.1-请求地址

地址1:/carrier

地址2:/carrier

请求方式可以 POST 和 GET方式,建议采用POST方式,默认返回为JSON格式

1.2-参数说明

例如:

/carrier?apikey=7c11272au708345c834b8ue81ac78972send&mobile=13972565391

1.3-响应数据

{"code": 0,"reason": "Succ","result": {"res": "1","Mobile": "13972565391","Area": "湖北-宜昌","Init_isp": "移动","Now_isp": "电信"

以下是在浏览器测试返回的数据:

2、余额查询接口

用于客户端查询当前账户余额,此接口可查询输出当前可以请求的次数。

2.1-请求地址

地址1:/balance

地址2:/balance

请求方式可以 POST 和 GET方式,建议采用POST方式,默认返回为JSON格式

2.2-参数说明

例如:

/balance?apikey=7c11272au708345c834b8ue81ac78972

2.3-响应数据

{"code": 0,"reason": "Succ","result":{"feeType": "预付费","balance": "12048", }}

以下是在浏览器测试返回的数据:

3. Code错误代码表

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。