联系客服: iP138.com客服 iP138客服 |

手机号码查询接口
  • API接口QQ交流群:177096428   iP138 api接口
  • 数据修正QQ处理群:94181690    iP138数据修正

手机号码查询接口支持HTTPS(赠送1000次)

简介:获取手机号码段的省市区以及运营商名称

已连接应用数:6857

国内:网宿cdn; 国际:亚洲中国香港、韩国首尔、日本东京、新加坡、欧洲德国法兰克福、北美洲美国硅谷节点

Java调用手机号码查询接口示例:

                                    public class QueryHelper {
                                        
                                        /**
                                         * txt|jsonp|xml
                                         */
                                        public static String DATATYPE="text";
                                        
                                        public static String get(String urlString,String token) {
                                            try {
                                                URL url = new URL(urlString);
                                                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                                                conn.setConnectTimeout(5 * 1000);
                                                conn.setReadTimeout(5 * 1000);
                                                conn.setDoInput(true);
                                                conn.setDoOutput(true);
                                                conn.setUseCaches(false);
                                                conn.setInstanceFollowRedirects(false);
                                                conn.setRequestMethod("GET"); 
                                                conn.setRequestProperty("token",token);
                                                int responseCode = conn.getResponseCode();
                                                if (responseCode == 200) {
                                                    StringBuilder builder = new StringBuilder();
                                                    BufferedReader br = new BufferedReader(
                                                            new InputStreamReader(conn.getInputStream(),"utf-8"));
                                                    for (String s = br.readLine(); s != null; s = br
                                                            .readLine()) {
                                                        builder.append(s);
                                                    }
                                                    br.close();
                                                    return builder.toString();
                                                }
                                            } catch (IOException e) {
                                                e.printStackTrace();
                                            }
                                            return null;
                                        }
                                        public static String queryPhone(String phone){
                                            String url="https://api.ip138.com/mobile/?mobile="+phone+"&datatype="+DATATYPE;
                                            String token="d0a79d9d5767b5f1f6926c9b08a71604";
                                            return get(url,token);
                                        }
                                    }   

                                    //以下是使用示例:
                                    //QueryIPHelper.queryPhone("13600130000");