public static String doGet(String url) {
if (url != null) {
if (UrlServer.checkNetworkInfo()) {
HttpGet httpRequest = new HttpGet(url);
httpRequest.addHeader("Accept-Encoding", "gzip");
HttpClient httpClient = getHttpClient();
HttpResponse httpResponse;
try {
httpResponse = httpClient.execute(httpRequest);
int code = httpResponse.getStatusLine().getStatusCode();
if (code == HttpStatus.SC_OK) {
HttpEntity httpEntity = httpResponse.getEntity();
InputStream is = httpEntity.getContent();
if (httpEntity.getContentEncoding() != null
&& httpEntity.getContentEncoding().getValue()
.contains("gzip")) {
is = new GZIPInputStream(is);
int i = -1;
byte[] b = new byte[1024];
StringBuilder sb = new StringBuilder();
while ((i = is.read(b)) != -1) {
sb.append(new String(b, 0, i,"utf-8"));
}
System.err.println(sb.toString());
return sb.toString();
}
return EntityUtils.toString(httpResponse.getEntity());

} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
App.app.handler.sendEmptyMessage(1);
}
}
return null;
}