How do I pass a JSONObject from Android application to a PHP file?
<p>I want to send a simple JSON object to PHP server,but when i try to retrieve that object on the server side,there is nothing i mean my $_POST variable is empty. The server side is PHP 5.2 and I'm using android emulator 10...Could someone have a look on my code and tell me what is going wrong?
Thanks a lot</p>

  <pre>public void uploadJSon() throws ClientProtocolException, IOException, JSONException{
       HttpClient httpclient = new DefaultHttpClient();
       String url = "http://so-dev-deb.niv2.com/suivi_activite/test.php";
       HttpPost httppost = new HttpPost(url);
       JSONObject json = new JSONObject();

       json.put("username", "bob");
       json.put("email", "test@testsite.com");
       List  nvps = new ArrayList ();

       nvps.add(new BasicNameValuePair("value", json.toString()));
       httppost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));                 

       URL test_url = new URL(url);
       URLConnection connection = test_url.openConnection();
       connection.setDoOutput(true);

       HttpResponse response;
       response = httpclient.execute(httppost);
       Log.i("NVPS",nvps.get(0).toString());
       Log.i("JSON",json.toString());
       Log.i("response", response.getEntity().getContent().toString());
       Log.i("response status",response.getStatusLine().toString());

       BufferedReader in = new BufferedReader(
             new InputStreamReader(
             connection.getInputStream()));

       String decodedString;

       while ((decodedString = in.readLine()) != null) {
          //System.out.println(decodedString);
          Log.i("info 10",decodedString);
       }
       in.close();

    }
  </pre>

<p>The server side test.php is : </p>

<pre><code>&lt;?php 
    $tmp = json_decode($_POST['value']); 
    var_dump($tmp); 
?&gt;
</code></pre>
