实现网页抓取
<%
/**
* Get the content of a web page
* @author bbflyerwww
* @date 2006/07/18
*/
String urlString = "http://www.163.com";
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
InputStream urlStream = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream));
String line = "";
String content = "";
while((line = reader.readLine()) != null) {
content += line;
}
out.println(content);
%>