title: android json post to php
body: <p>I have done raw rest get and post and also could do post in namevaluepair but no matter which tutorial i follow i just cant get json post done ...</p>
  
  <p><strong>Android Application:</strong></p>
  
  <pre><code>ArrayList&lt;String&gt; stringData = new ArrayList&lt;String&gt;();
  DefaultHttpClient httpClient = new DefaultHttpClient();
  HttpPost postMethod = new HttpPost("http://192.168.1.10/people.php");     
  
  JSONObject holder = new JSONObject();
  holder.put("name", "Foo");    
  holder.put("occupation", "Bar");
  
  StringEntity se = new StringEntity(holder.toString());
  postMethod.setEntity(se);
  postMethod.setHeader("Accept", "application/json");
  postMethod.setHeader("Content-type", "application/json");
  
  ResponseHandler &lt;String&gt; resonseHandler = new BasicResponseHandler();
  String response=httpClient.execute(postMethod,resonseHandler); 
  stringData.add(response);
  
  return stringData;
  </code></pre>
  
  <p><strong>PHP file:</strong></p>
  
  <pre><code>if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  
   var_dump($_POST);
  }
  </code></pre>
  
  <p>the var_dump just gives an empty array and $_POST["name"] gives undefined index ... any help would be nice</p>