日期:2014-05-17 浏览次数:20643 次
?public void getHtml() throws ClientProtocolException, IOException?
{?
? ? HttpClient httpClient = new DefaultHttpClient();?
? ? HttpContext localContext = new BasicHttpContext();?
? ? HttpGet httpGet = new HttpGet("http://www.spartanjava.com");?
? ? HttpResponse response = httpClient.execute(httpGet, localContext);?
? ? String result = "";?
?
? ? BufferedReader reader = new BufferedReader(?
? ? ? ? new InputStreamReader(?
? ? ? ? ? response.getEntity().getContent()?
? ? ? ? )?
? ? ? );?
?
? ? String line = null;?
? ? while