赞
踩
身份证号查询
-
- import org.jsoup.Jsoup;
-
- import java.io.IOException;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
-
- public class Id {
- public static void main(String[] args) {
- String id ="******************";
- String u = "https://qq.ip138.com/idsearch/index.asp?userid=" +id+"&action=idcard";
- System.out.println(id);
- try {
- String t = Jsoup.connect(u).get().toString();
- Pattern p = Pattern.compile("[\\u4e00-\\u9fa5\\s]+?<br>");
-
- Pattern p2 = Pattern.compile("男|女");
- Matcher m2 = p2.matcher(t);
- m2.find();
- System.out.println(m2.group());
-
- Pattern p3 = Pattern.compile("\\d{4}年\\d{2}月\\d{2}日");
- Matcher m3 = p3.matcher(t);
- m3.find();
- System.out.println(m3.group());
-
- Matcher m = p.matcher(t);
- while (m.find()){
- System.out.println(m.group().replace("<br>","").replace("",""));
- System.out.println(m.group().replaceAll("[^\\u4e00-\\u9fa5]",""));
- }
- } catch (IllegalStateException e) {
- System.out.println("未找到");
- throw new RuntimeException(e);
- }catch (IOException e){
- System.out.println("网络异常");
- }catch (Exception e){
- System.out.println("未知错误异常");
- }
-
- }
-
-
- }
手机号查询
- package cn;
-
- import org.jsoup.Jsoup;
-
- import java.io.IOException;
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
-
- public class Tell {
- public static void main(String[] args) throws IOException {
- Scanner sc = new Scanner(System.in);
- System.out.print("请输入手机号");
- String tell = sc.nextLine();
- String u = String.format("https://ip138.com/mobile.asp?mobile=%s&action=mobile",tell);
- String html = Jsoup.connect(u).get().toString();
- Pattern pattern = Pattern.compile("<td><span>(.*)</span></td>");
- Matcher matcher = pattern.matcher(html);
- while (matcher.find()){
- System.out.println(matcher.group(1).replace(" ",""));
- }
-
-
- }
-
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。