1

I have to send json array to the server from android application. i'm able to send data through httpget but i want to send it through httppost i saw the examples but my data are not posting.

i get the response code 200 even i'm passing the wrong parameter in url what's the reason behind this.

here is my code:

DefaultHttpClient UserIDclient = MySSLSocketFactory.getNewHttpClient();
HttpPost httppost = new HttpPost("my url");
List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
nvps.add(new BasicNameValuePair("api","apiname"));
nvps.add(new BasicNameValuePair("user_id","179"));
nvps.add(new BasicNameValuePair("child_id","94"));
nvps.add(new BasicNameValuePair("json",json array));
UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,HTTP.UTF_8);

httppost.setEntity(p_entity);
HttpResponse response = UserIDclient.execute(httppost);
Jim G.
  • 15,141
  • 22
  • 103
  • 166
Dipen Patel
  • 23
  • 1
  • 5
  • Please check the below link . Here you can find how to send the json object to server using HttpPost. [Click Me](http://stackoverflow.com/a/3027900/614807) [Click Me](http://stackoverflow.com/a/6218235/614807) – Chirag Feb 22 '12 at 05:00

0 Answers0