private JSONObject httpGet(String path) {
try {
// 创建HttpClient实例
HttpClient httpclient = new DefaultHttpClient();
// 创建Get方法实例
HttpGet httpgets = new HttpGet(path);
HttpResponse response = httpclient.execute(httpgets);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instreams = entity.getContent();
String str = convertStreamToString(instreams);
JSONObject json = JSONObject.fromObject(str);
httpgets.abort();
return json;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
try {
// 创建HttpClient实例
HttpClient httpclient = new DefaultHttpClient();
// 创建Get方法实例
HttpGet httpgets = new HttpGet(path);
HttpResponse response = httpclient.execute(httpgets);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instreams = entity.getContent();
String str = convertStreamToString(instreams);
JSONObject json = JSONObject.fromObject(str);
httpgets.abort();
return json;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}