如何读取远程网站页面. 什么意思?是想抓163.com新闻? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是要读取远程主机上一个html页面比如http://xxx/kkk.html然后转成一个String. <jsp:include page="http://xxx/kkk.html"></jsp:include> <form onSubmit="location.href = 'view-source:' + location; return false;"><input type="submit" value="查看源代码!"></form>把location换成网址即可 比如:<form onSubmit="location.href = 'view-source:' + 'http://www.sina.com.cn'; return false;"><input type="submit" value="查看源代码!"></form> import java.net.*;import java.io.*;public class ReadURL { public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("用法:ReadURL <URL地址>"); return; } URL url = new URL(args[0]); BufferedReader in = new BufferedReader( new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); }} 我的网站运行每隔一周就不能连接数据库了,啥原因呢 JCR spring事务 回答有分 关于读于从baidu或google关键字搜索链接过来时接取始发地址和关键字 如何解决用户密码中含有特殊字符的查询?????? 如何在WEB页显示一个已经存在的excel文件 struts 项目出现下列问题 请问怎样解决 为什么采用rowset,有什么好处,高手请进。 出学jsp奇怪的数据库问题 jsp连接oracle为什么那么慢! 一个十分简单的测试,都没通过.可能是让我改坏了,大家帮我看看 为什么改了servlet浏览器仍然访问原来的
http://xxx/kkk.html然后转成一个String.
</jsp:include>
<input type="submit" value="查看源代码!">
</form>把location换成网址即可
<form onSubmit="location.href = 'view-source:' + 'http://www.sina.com.cn'; return false;">
<input type="submit" value="查看源代码!">
</form>
import java.io.*;public class ReadURL {
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.out.println("用法:ReadURL <URL地址>");
return;
}
URL url = new URL(args[0]);
BufferedReader in = new BufferedReader(
new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}