I use my code to upload data in MySQL.
HttpPost httppost = new HttpPost(URL_POST_TIENDAS);
HttpClient client = new DefaultHttpClient();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("data", json));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
// Log.e(TAG, "Ejecutando POST: Mandando tiendas");
HttpResponse httpResponse = client.execute(httppost);
if (httpResponse != null) {
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode == 200) {
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
message = NetworkUtils.Entity2String(httpResponse);
Log.e(TAG, "Respuesta del Post Tienda:" + message);
}
} else {
Err error = new Err(statusCode, message, "upload_tiendas");
MyApplication.lErrors.add(error);
this.cancel(true);
}
This code give me a 500 Error
In PHP, I receive my variable with $_REQUEST, so when I debug my app, copy json variable and put it in the full URL, there is no problem.
This show my json variable is OK, as URL_POST_TIENDAS.
Why is there a problem with using POST??? This is not the first time I find this problem. I always change it to GET, but this time, I want to understand why it fails, because I could have a lot of information to upload, so GET is not very appropriated!
EDIT : When seeing logs server, I don't see anything about my 500 error.
EDIT2: httpost :
httppost HttpPost (id=830032727152)
aborted false
abortLock ReentrantLock (id=830032727328)
connRequest null
entity UrlEncodedFormEntity (id=830032731528)
chunked false
content (id=830032746160)
[0...99]
[100...199]
[200...299]
[300...399]
[400...499]
[500...599]
[600...699]
[700...724]
contentEncoding null
contentType BasicHeader (id=830032747320)
headergroup HeaderGroup (id=830032727200)
headers ArrayList (id=830032727216)
array Object[16] (id=830032727240)
modCount 0
size 0
params BasicHttpParams (id=830032789608)
parameters null
releaseTrigger SingleClientConnManager$ConnAdapter (id=830032798576)
uri URI (id=830032727376)
Any Help will be appreciated !