网络爬虫 网络爬虫如何 实现 根据post提交的参数做出响应,返回所要的网页? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用httpclient来模拟客户端发送请求 并抓取数据 可以参考 http://www.gbsou.com/2009/10/09/988.htmlhttp://www.gbsou.com/2009/10/09/1010.html (httpclient 抓取博客园帖子) 建议你用 webharverst实现一下,网上资料很多 URL url=new URL("url"); HttpURLConnection conn=(HttpURLConnection)url.openConnection(); conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setDoInput(true); String param="name=张三&age=25"; conn.getOutputStream().write(param.getBytes()); conn.getOutputStream().flush(); conn.getOutputStream().close(); if(conn.getResponseCode()==200){ p(conn.getResponseMessage()); lineReader=new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8")); String line=null; while((line=lineReader.readLine())!=null){ p(line); } } 本该从甚么地方听来的,就去甚么地方求索。其实对网络编程有所时日的程序员,网络爬虫、下载攻击之类的小程序不在话下。关键是几个重要的api要懂得使用。这里给你一些思路。简单一点吧,就三点:1:获取网络某一资源,如html,rar,exe...主要是html。2:解析html,过滤获取想要的内容,如A标签的href..以及标题等内容。做好保存3:根据步骤2中提取的内容,继续重复1-2-3。深度获取其信息。如真要去实现,牵扯到的技术也很多,值得去练习。 jsp连接数据库问题 关于cookie免登录的问题 能否在网页上调用本地视频文件,并显示在网页上,bho可以做到吗? 急。。求解。。。JAVA能否实现B/S的FTP功能 轻松拿到这10分!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 刚才交了辞职信,顺便问个小问题,再散点小分:) 再给100分解决servlet不能调用问题 解决用户同时在线问题,请教 救命啊!!!!!!!!!!!!!!为什么JSP中的<%%>不起作用?? java调用本地API,在linux下面应该怎么做呀? jsp提交到servlet找不到 404错误 请高手指点 struts2 radio
可以参考 http://www.gbsou.com/2009/10/09/988.html
http://www.gbsou.com/2009/10/09/1010.html (httpclient 抓取博客园帖子)
URL url=new URL("url");
HttpURLConnection conn=(HttpURLConnection)url.openConnection();
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
String param="name=张三&age=25";
conn.getOutputStream().write(param.getBytes());
conn.getOutputStream().flush();
conn.getOutputStream().close();
if(conn.getResponseCode()==200){
p(conn.getResponseMessage());
lineReader=new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
String line=null;
while((line=lineReader.readLine())!=null){
p(line);
}
}
1:获取网络某一资源,如html,rar,exe...主要是html。
2:解析html,过滤获取想要的内容,如A标签的href..以及标题等内容。做好保存
3:根据步骤2中提取的内容,继续重复1-2-3。深度获取其信息。如真要去实现,牵扯到的技术也很多,值得去练习。