Am using okhttp to send and receive data to and from the server not working as expected or am I doing something wrong.
My Android Client Side, bear in mind I have already instantiated the client okHttp object and my containing class already implements the .enqueue
asynchronous methods.
JSONObject obj = new JSONObject();
obj.put("usr", "alex");
final MediaType JSON
= MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON, json);
request = new Request.Builder()
.url(config.SERVER_GET_RECEIPTS)
.post(body)
.build();
client.newCall(request).enqueue(this);
The response from my server side is a string I put in place if the $_POST
variable is empty. and it returns this string.
if(!empty($_POST)){
echo "Properly Parsed" . $_POST['usr'];
}else{
echo "Not Properly Parsed";
}