java号段_Java 获取区域号段

java号段_Java 获取区域号段/**Tochangethistemplate,chooseTools|Templates*andopenthetemplateintheeditor.*/packagephone;importcom.mysql.jdbc.Connection;importcom.mysql.jdbc.PreparedStatement;importorg.apache.ht…

/*

* 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 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

1

4

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2014-03-27 10:26

浏览 1358

评论

3 楼

Demon_311

2014-03-29

可以的呀

2 楼

mfkvfn

2014-03-27

那代码显然是JDK7的。JDK6不能通过编译

1 楼

Vity

2014-03-27

JDK6 呢

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/37785.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注