Java 获取区域号段
2015-10-23 09:57
357 查看
jar 在下面自己下载
祝你好运!!!
jar.rar (1.7 MB)
下载次数: 4
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package phone; import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import org.apache.http.client.ResponseHandler; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.apache.http.impl.client.DefaultHttpClient; /** * * @author Administrator */ public class JavaApp { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { //获取连接 HttpClient httpclient = new DefaultHttpClient(); ResponseHandler<String> responseHandler = new BasicResponseHandler(); //String ok=""; //三大运营商每年都有新号段根据情况添加号段 String[] haoduan = {"130", "131", "132", "133", "134", "135", "136", "137", "138", "153", "155", "156", "189", "139", "150", "151", "152", "157","185","186", "145", "180", "158", "159", "182", "183", "187", "188", "147"}; for (String x : haoduan) { //System.out.println(x); for (int i = 0; i < 10000; i++) { int k = Integer.parseInt(x) * 10000; k = k + i; // System.out.println(k); HttpGet httpget = new HttpGet("http://haoma.imobile.com.cn/index.php?mob=" + k); //HttpGet httpget = new HttpGet("http://www.ip138.com:8080/search.asp?action=mobile&mobile="+k); String responseBody = httpclient.execute(httpget, responseHandler); //System.out.println(responseBody); //JSONObject json = JSON.parseObject(responseBody); if (responseBody.indexOf("上海") > 0) { //修改你想获取地区号码 // ok=ok+"|"+k; System.out.println(k + "【上海】-" + YunYingShang(x));//修改你想获取地区号码 //ps = (PreparedStatement) conn.prepareStatement("insert into allnumber(number,Callerloc,tmobile) values (?,?,?)"); } } } } public static String YunYingShang(String s) { switch (s) { default: case "130": return "联通"; case "131": return "联通"; case "132": return "联通"; case "155": return "联通"; case "156": return "联通"; case "186": return "联通"; case "145": return "联通"; case "185": return "联通"; case "134": return "移动"; case "135": return "移动"; case "136": return "移动"; case "137": return "移动"; case "138": return "移动"; case "139": return "移动"; case "150": return "移动"; case "151": return "移动"; case "152": return "移动"; case "157": return "移动"; case "158": return "移动"; case "159": return "移动"; case "182": return "移动"; case "183": return "移动"; case "187": return "移动"; case "188": return "移动"; case "147": return "移动"; case "180": return "电信"; case "181": return "电信"; case "133": return "电信"; case "153": return "电信"; case "189": return "电信"; } } }
祝你好运!!!
jar.rar (1.7 MB)
下载次数: 4
相关文章推荐
- JAVA环境变量JAVA_HOME、CLASSPATH、PATH设置详解
- java生成excel并下载(jxl)
- java 移位运算符
- interface Java 中接口
- Java web.xml session-config 属性配置
- Eclipse swt开发环境搭建
- JVM的相关知识整理和学习
- Java基础增强3-反射,内省,beanutils,泛型
- java内存分配和String类型的深度解析
- Spring Boot应用之数据加密以及字段过滤
- 深度优先实现拓扑排序--java
- 在Servlet中获取Spring的指定bean
- java keytool证书工具使用小结
- SpringMVC+MyBatis+EasyUI 实现分页查询
- eclipse项目没错但有红叉
- JAVA初始化过程
- 完成这个例子,说出java中针对异常的处理机制。
- java高精度开平方
- Java基本数据类型
- java开源微博系统weibo4j分享