httpclient htmlparser来查询手机号相关信息
http://htmlparser.com.cn/post/20090816119.html
public class GetMobile {
/**
* @author rrong_m 51jsp.cn
* @throws IOException
* @throws HttpException
* @throws IOException
* @throws HttpException
* @throws ParserException
*/
public static String getPostString(String mobile) throws HttpException, IOException//发送数据51jsp.cn
{
HttpClient hc=new HttpClient();
PostMethod pm=new PostMethod("http://www.ip138.com:8080/search.asp");
hc.getParams().setContentCharset("gb2312");
pm.addParameter("mobile",mobile);
pm.addParameter("action","mobile");
hc.executeMethod(pm);
return pm.getResponseBodyAsString();
}
public static void getMobileInfor(String poststring) throws ParserException
{
Parser parser=new Parser(poststring);
NodeList nodelist=null;
NodeFilter filter=new HasAttributeFilter("class","tdc2");
nodelist=parser.extractAllNodesThatMatch(filter);
for(int i=0;i<nodelist.size();i++)
{
System.out.println(nodelist.elementAt(i).toPlainTextString().replace(" ",""));
}
}
public static void main(String[] args) throws HttpException, IOException, ParserException {
getMobileInfor(getPostString("1380001"));//直接填写想要查询的手机号码
}
}
分享到:
相关推荐
爬数据案例,二叉树典型案例,htmlparser读取html,httpclient实例应用,运用了迭代实现。
Android平台HttpClient的使用-手机号码归属地查询
使用 HttpClient 和 HtmlParser 实现简易网络爬虫
本文研究了 HttpClient、HTMLParser 等技术,提出并实现了一种基于HttpClient 与HTMLParser 的网 页抓取解析方法,该方法能够快速有效对HTML 页面进行抓取解析
使用 HttpClient 和 HtmlParser 实现简易爬虫
这段时间在做一个网络爬虫,但是关于HTTPclient+htmlparser两个开源工具包很多版本都不全,这里是我自己收集的、绝对可用的,比较完整的版本。 导入后,需要用import引用. 希望有用,也是我自己做的备份。
基於HttpClient和HtmlParser的簡單查詢系統(源碼)
HttpClient&&HtmlParser(Crawler)网络爬虫 HttpClient&&HtmlParser(Crawler)网络爬虫
网络爬虫开发工具包 httpClient 是旧版的,大部分网上的爬虫教程用的都是这个工具包
利用HttpClient和HtmlParser实现的简单爬虫(Java)
基于HttpClient与HTMLParser的网页正文提取,陈智彬,崔鸿雁,随着互联网的高速发展,针对互联网的分析处理显得日益重要。本文研究了HttpClient、HTMLParser等技术,提出并实现了一种基于HttpClient与HTM
这是使用_HttpClient_和_HtmlParser_实现的一个简易爬虫程序。
HtmlParser和HttpClient学习资料,其中包括网络爬虫的源码和一些在网上找到的学习资料
NULL 博文链接:https://tristan-s.iteye.com/blog/1130983
NULL 博文链接:https://azure2a.iteye.com/blog/901363
爬虫工程师需要设计相应的策略来应对这些挑战。 爬虫在各个领域都有广泛的应用,包括搜索引擎索引、数据挖掘、价格监测、新闻聚合等。然而,使用爬虫需要遵守法律和伦理规范,尊重网站的使用政策,并确保对被访问...