I want to send a php array via POST from android to php server and i have this code
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
StringEntity dades = new StringEntity(data);
httppost.setEntity(dades);
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
return resEntity.getContent();
I think that the php array may be can go in
StringEntity dades = new StringEntity(data);
(data is the php array). Can anyone help me?
The code above will send an array like this:
[id=12345, stringdata=AndDev is Cool!]
If you want a bidimentional array you should do this
This will create an array containing an array:
I hope this is what you want.
You can do something like this :
where colour is your array tag. Just use
[]
after your array tag and put value. Eg. if your array tag name iscolour
then use it likecolour[]
and put value in loop.