1

Android POST JSON OBJECT - How to set $_POST Index

view story
linux-howto

http://stackoverflow.com – i have a JSONObject which i want to POST to a server. Here is the Code: JSONObject obj = new JSONObject(); for(int k = 0; k<len;k++){ obj.put("nachrichten_ids", params[k]); } HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("xxxxx"); HttpEntity entity; StringEntity s = new StringEntity(obj.toString()); s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); entity = s; httpPost.setEntity(entity); HttpResponse response; response = httpClient.execute(httpPost); By doing Log.i("TEST",obj) i get the JSON object: {"nachrichten_ids" (HowTos)