Read PHP echo into string in Android
android
Solution
The HTTPResponse object in your code is a java object holding the response. It isn't a plain string. Therefore, printing the object results in the given log output. To access the php echo, you could try following code:
response = httpClient.execute(targetHost, targetGet);
HttpEntity entity = response.getEntity();
String htmlResponse = EntityUtils.toString(entity);
Problem
I need to read this echo: http://wee.co.il/Ski/weatherScript.php?op=3 into string, I have tried: ``` class RetreiveEcho extends AsyncTask<String, Void, String> { private static final String TAG = "Her"; @Override protected String doInBackground(String... params) { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://wee.co.il/Ski/weatherScript.php?op=3"); Log.d(TAG, "Hello!"); try { HttpResponse response = httpclient.execute(httppost); Log.d(TAG, ""+response); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } } ``` For now I only see in my log: ``` org.apache.http.message.BasicHttpResponse@4132e5a8 ```