<%@ page contenttype="text/html;charset=gb2312"%>
<%
string scurrentline;
string stotalstring;
scurrentline="";
stotalstring="";
java.io.inputstream l_urlstream;
java.net.url l_url = new java.net.url("http://www.163.net/");
java.net.httpurlconnection l_connection = (java.net.httpurlconnection) l_url.openconnection();
l_connection.connect();
l_urlstream = l_connection.getinputstream();
java.io.bufferedreader l_reader = new java.io.bufferedreader(new java.io.inputstreamreader(l_urlstream));
while ((scurrentline = l_reader.readline()) != null)
{
stotalstring+=scurrentline;
}
out.println(stotalstring);
%>
后记
虽然代码比较简单,但是,我认为根据这个,可以实现“网络爬虫”的功能,比如从页面找href连接,然后再得到那个连接,然后再“抓”,不停止地(当然可以限定层数),这样,可以实现“网页搜索”功能。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器