Reputation: 14101
I am connecting to a php page via httppost in Android. I am getting an IOException. I am running in localhost. What is the reason for this? Please help. The code is like this.
htClient = new DefaultHttpClient();
httpPost = new HttpPost("http://localhost/form/android_test.php");
response = new BasicResponseHandler();
try
{
result = htClient.execute(httpPost,response);
Toast.makeText(active.this,result, Toast.LENGTH_SHORT).show();
}
catch (ClientProtocolException e) {
Toast.makeText(active.this,e.getMessage(), Toast.LENGTH_SHORT).show();
}
catch (IOException e) {
// i am always getting this exception.
Toast.makeText(active.this,"IO Error " + e.getMessage(), Toast.LENGTH_LONG).show();
}
Upvotes: 0
Views: 344