Test.java
资源名称:MY_PAPA.rar [点击查看]
上传用户:xie_wn
上传日期:2022-03-04
资源大小:941k
文件大小:3k
源码类别:
网络截获/分析
开发平台:
Java
- package com.util;
- import org.apache.commons.httpclient.NameValuePair;
- import au.id.jericho.lib.html.Attributes;
- import au.id.jericho.lib.html.Segment;
- import au.id.jericho.lib.html.Source;
- public class Test {
- /**
- * @param args
- */
- public String testip()
- {
- String url="http://www.ip138.com/ips.asp";
- NameValuePair nvp1=new NameValuePair("action","2");
- NameValuePair nvp2=new NameValuePair("ip","124.235.143.219");
- NameValuePair[] aa=new NameValuePair[]{nvp1,nvp2};
- ClientUtil cu=new ClientUtil();
- Source s=new Source(cu.post(url, aa));
- //System.out.println(s.toString());
- Segment sg=HtmlUtil.getSegment("table", 2, s);
- // System.out.println(sg.toString());
- Segment td=HtmlUtil.getSegment2("td", 2, sg);
- Segment ul=HtmlUtil.getSegment2("ul", 0, td);
- System.out.println(ul.toString());
- return ul.toString();
- }
- public String testsj()
- {
- String url="http://www.ip138.com:8080/search.asp";
- NameValuePair nvp1=new NameValuePair("action","mobile");
- NameValuePair nvp2=new NameValuePair("mobile","13244684164");
- NameValuePair[] aa=new NameValuePair[]{nvp1,nvp2};
- ClientUtil cu=new ClientUtil();
- Source s=new Source(cu.post(url, aa));
- System.out.println(s.toString());
- Segment sg=HtmlUtil.getSegment("table", 1, s);
- String gsd=HtmlUtil.getSegment2("td",4, sg).extractText();
- String klx=HtmlUtil.getSegment2("td",4, sg).extractText();
- System.out.println(gsd+"dddddddd"+klx);
- return null;
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- // String url="http://www.ip138.com:8080/search.asp";
- // NameValuePair nvp1=new NameValuePair("action","mobile");
- // NameValuePair nvp2=new NameValuePair("mobile","13244684164");
- // NameValuePair[] aa=new NameValuePair[]{nvp1,nvp2};
- // ClientUtil cu=new ClientUtil();
- // Source s=new Source(cu.post(url, aa));
- // System.out.println(s.toString());
- // Segment sg=HtmlUtil.getSegment("table", 1, s);
- // String gsd=HtmlUtil.getSegment2("td",8, sg).extractText();
- // String klx=HtmlUtil.getSegment2("td",10, sg).extractText();
- // System.out.println(gsd+"dddddddd"+klx);
- //Segment td=HtmlUtil.getSegment2("td", 2, sg);
- String url="http://qq.ip138.com/idsearch/index.asp";
- NameValuePair nvp1=new NameValuePair("action","idcard");
- NameValuePair nvp2=new NameValuePair("userid","230105198306031915");
- NameValuePair[] aa=new NameValuePair[]{nvp1,nvp2};
- ClientUtil cu=new ClientUtil();
- //System.out.println(cu.post(url, aa));
- Source s=new Source(cu.post(url, aa));
- Segment sg=HtmlUtil.getSegment("table",4, s);
- // System.out.println(sg.toString());
- // System.out.println(sg.toString());
- // System.out.println(sg.extractText(false));
- String gsd=HtmlUtil.getSegment2("td",1, sg).extractText();
- String klx=HtmlUtil.getSegment2("td",3, sg).extractText();
- System.out.println(gsd+"==="+klx);
- // Segment td=HtmlUtil.getSegment2("td", 2, sg);
- // System.out.println(td.extractText());
- //
- }
- }