I am developing an Android App. I need to connect to my PHP and i am usig HttpPost. This is my code. I've followed several tutorials and it doesn't work. The error is that the PHP doesn't receive the parameters that I pass from my App code. Although it connects correctly to the PHP. I've used POSTman to find errors in the PHP but it works fine. I put my code here :
private void httppostconnect(ArrayList<NameValuePair> parametros, String urlwebserver) {
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(urlwebserver);
httppost.setEntity(new UrlEncodedFormEntity(parametros));
//ejecuto peticion enviando datos por POST
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
} catch(Exception e) {
Log.e("GetBuscadas", "Error in http connection "+e.toString());
}
}
Can you clarify what those parameters are, your "parametros" var. The usual problem would be not sending content type headers.