将内容过程重要的内容记录起来,下边内容内容是关于Java 发出HTTP GET请求抓取网页内容的内容。
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response1 = httpclient.execute(httpGet);
try {
System.out.println(response1.getStatusLine());
HttpEntity entity1 = response1.getEntity();
String strResult = EntityUtils.toString(entity1);
System.out.println(strResult);
EntityUtils.consume(entity1);
} finally {
httpGet.releaseConnection();
}
网友评论