Cannot acces post data sent from okhttp from php
<p>i send post request with a json object to php in server, but php keep telling $_POST is empty.</p>

<p>this is okhttp code </p>

<pre><code>    public String postConection(JSONObject pJson, String pUrl) throws IOException {
    final MediaType JSON
            = MediaType.parse("application/json; charset=utf-8");

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
            .permitAll().build();
    StrictMode.setThreadPolicy(policy);

    String dirArchivo = "http://10.0.2.2/SoulStoreProject/"+pUrl;

    OkHttpClient client = new OkHttpClient();

    RequestBody body = RequestBody.create(JSON, pJson.toString());
    Request request = new Request.Builder()
            .url(dirArchivo)
            .post(body)
            .build();
    Response response = client.newCall(request).execute();
    return response.body().string();
}
</code></pre>

<p>and this is the php code</p>

<pre><code>$nick = $_POST['nick'];
$password = $_POST['password']; 

$query = "
    INSERT INTO 
        players(nick, password) 
        VALUES($nick,$password)
    ";


$DB-&gt;Execute($query);
</code></pre>