科技馆网站建设,江苏瀚和建设网站,黑色风格网站主页面,网址查询服务中心这段代码是查询指定手机号的代码归属地#xff0c;输出格式为【省份运营商】public static String checkMobilePlace(String mobilephone)throws IOException {//检测手机号码归属地URL url new URL(http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel … 这段代码是查询指定手机号的代码归属地输出格式为【省份运营商】public static String checkMobilePlace(String mobilephone)throws IOException {//检测手机号码归属地URL url new URL(http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel mobilephone t new Date().getTime());URLConnection urlConnection url.openConnection();InputStream inputStream urlConnection.getInputStream();//取回查询结果String result;int c;while (((c inputStream.read()) ! -1)) {int all inputStream.available();byte[] b new byte[all];inputStream.read(b);result new String(b, GBK);}HttpURLConnection httpConnection (HttpURLConnection) urlConnection;String phoneadd result.substring(55, 57)result.substring(76, 78);System.out.println(phoneadd);return phoneadd;}测试用例checkMobilePlace(15200033333);运行结果河北移动 转载于:https://blog.51cto.com/jormin/1313064