Skip to content Skip to sidebar Skip to footer

Why Isn't The Server Returning Anything?

I used the following piece of code to retrieve basically a JSON formatted String from a php page (www.ace.ucv.ro/android/android.php). For some reason, no matter what I try, the st

Solution 1:

JSON response is normally gzipped, try this

jsonResponse = client.execute(httpGet);
InputStream in = response.getEntity().getContent();
GZIPInputStream gin = new GZIPInputStream(in);
BufferedReader reader = new BufferedReader(new InputStreamReader(gin));
String line;
while ((line = reader.readLine()) != null) {
    jsonResponse.append(line);
}
reader.close();

Post a Comment for "Why Isn't The Server Returning Anything?"