package zeze; import java.io.IOException; import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class Yuming { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String key="chzeze.cc"; int s1,s2; String url="http://whoissoft.com/"+key+""; Connection conn = Jsoup.connect(url); Document doc=null; doc=conn.timeout(50000).get(); Elements results = null; results=doc.select("[class = con]"); String re=results.get(0).text(); //System.out.println(re); s1= re.indexOf("Domain Name:")+12; s2=re.indexOf("IP Address"); String str=re.substring(s1, s2).trim(); System.out.println("域名:"+str); s1= re.indexOf("Updated Date:")+13; s2=re.indexOf("Creation Date:"); str=re.substring(s1, s2).trim(); String[] aa=str.split("-"); String y=aa[0],m=aa[1]; aa=aa[2].split(":"); String d=aa[0].substring(0, 2),h=aa[0].substring(3, 5),mm=aa[1],ss=aa[2].substring(0, 2); System.out.println("更新时间:"+y+"-"+m+"-"+d+" "+h+":"+mm+":"+ss); //System.out.println("更新时间:"+str); s1= re.indexOf("Creation Date")+14; s2=re.indexOf("Registry Expiry Date:"); str=re.substring(s1, s2).trim(); aa=str.split("-"); y=aa[0];m=aa[1]; aa=aa[2].split(":"); d=aa[0].substring(0, 2);h=aa[0].substring(3, 5);mm=aa[1];ss=aa[2].substring(0, 2); System.out.println("创建时间:"+y+"-"+m+"-"+d+" "+h+":"+mm+":"+ss); s1= re.indexOf("Registry Expiry Date")+21; s2=re.indexOf("Sponsoring Registrar"); str=re.substring(s1, s2).trim(); aa=str.split("-"); y=aa[0];m=aa[1]; aa=aa[2].split(":"); d=aa[0].substring(0, 2);h=aa[0].substring(3, 5);mm=aa[1];ss=aa[2].substring(0, 2); System.out.println("到期时间:"+y+"-"+m+"-"+d+" "+h+":"+mm+":"+ss); s1= re.indexOf("database:")+9; s2=re.indexOf("<<< WHOIS"); str=re.substring(s1, s2).trim(); aa=str.split("-"); y=aa[0];m=aa[1]; aa=aa[2].split(":"); d=aa[0].substring(0, 2);h=aa[0].substring(3, 5);mm=aa[1];ss=aa[2].substring(0, 2); System.out.println("数据时间:"+y+"-"+m+"-"+d+" "+h+":"+mm+":"+ss); } }