我已经成功地从网上检索http值。检索来自android的http响应
但是,我仍然很少知道我是如何从网上检索价值的。
我有一个代码。但是,如果不理解它,它是为了什么?
所以......我想问三个问题来理解我的代码。
HTTPGet
,HTTPClient
,EntityUtils
。
我只是猜测HTTPGet所做的是抓取http编码制作的http数据。
我猜HTTPClient
是用于数据封装。
and .. EntityUtils
?我真的没有想法。什么是entitiy?为什么我需要这个
以HTTPresponse
作为字符串?他做什么的?
下面是我的代码。
HttpGet get = new HttpGet(tempURL);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(get);
String responseBody = EntityUtils.toString(response.getEntity());
试试这个链接http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html你可以找到你的答案 – Ajay 2012-02-24 10:17:28