62,620
社区成员
发帖
与我相关
我的任务
分享
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response ;
HttpGet get =new HttpGet("http://www.8684.cn/");
try {
response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
System.out.println(EntityUtils.toString(entity));
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = null;
HttpGet get =new HttpGet("http://www.8684.cn/");
try {
response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent()));
String temp = null;
while( (temp = br.readLine())!=null ){
System.out.println(temp);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}