HttpResponse to string length 0 is returned
<p>I am trying to make an HTTPGet request on a server in an Android APP, but when I change the httpresponse in string, the string is 0 length.</p>

<pre><code>DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://"+server+path+"?assets="+URLEncoder.encode(query, "US-ASCII")+"&amp;lt="+localTime+"&amp;to="+timeOffset);
HttpResponse response = httpclient.execute(httpget);
System.out.println("Status"+ response.getStatusLine());
System.out.println("Length "+org.apache.http.util.EntityUtils.toString(response.getEntity()).length());
return org.apache.http.util.EntityUtils.toString(response.getEntity());
</code></pre>

<p>Catlog :</p>

<pre><code>I/System.out(22344): StatusHTTP/1.1 200 OK
I/System.out(21737): Length 0
</code></pre>

<p>The uri is good,when I copy/past it in a browser I have a result like this :</p>

<pre><code>{"ads":[{"i"...],"pxs":{}}
</code></pre>

<p>Does anyone have an idea why my string is empty?</p>

<p>Udpate 1:</p>

<pre><code>    long localTime = System.currentTimeMillis();
    Date date = new Date();
    @SuppressWarnings("deprecation")
    int timeOffset = date.getTimezoneOffset ();
</code></pre>

<p>Update 2:</p>

<p>I added this line :</p>

<pre><code>httpget.setHeader("User-Agent", "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)");
</code></pre>

<p>And now I have this error :</p>

<p>Catlog</p>

<pre><code> E/AndroidRuntime(23584): FATAL EXCEPTION: AsyncTask #2
 E/AndroidRuntime(23584): java.lang.RuntimeException: An error occured while executing doInBackground()
 E/AndroidRuntime(23584):   at android.os.AsyncTask$3.done(AsyncTask.java:278)
 E/AndroidRuntime(23584):   at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
 E/AndroidRuntime(23584):   at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
 E/AndroidRuntime(23584):   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
 E/AndroidRuntime(23584):   at java.util.concurrent.FutureTask.run(FutureTask.java:137)
 E/AndroidRuntime(23584):   at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
 E/AndroidRuntime(23584):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
 E/AndroidRuntime(23584):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
 E/AndroidRuntime(23584):   at java.lang.Thread.run(Thread.java:864)
 E/AndroidRuntime(23584): Caused by: java.lang.IllegalStateException: Content has been consumed
 E/AndroidRuntime(23584):   at org.apache.http.entity.BasicHttpEntity.getContent(BasicHttpEntity.java:84)
</code></pre>
