Difficulty implementing POST request with JSONArrayRequest

64 Views Asked by At

For some reason the data I'm trying to POST to my hosted PHP script isn't transmitting properly. I know through Hurl.it that my PHP script is working fine and that the variable I should be passing through POST is accessible within my class, however for some reason the POST isn't working.

My code is below:

public JSONObject getParams() {
        Map<String, String> params = new HashMap<>();
        params.put("tag", "gamesList");
        params.put("userID", userID);

        postItems = new JSONObject(params);
        return postItems;
    }

    private void sendJsonRequest() {

        JsonArrayRequest request = new JsonArrayRequest(Request.Method.POST, getRequestURL(10), getParams(), new Response.Listener<JSONArray>() {
            @Override
            public void onResponse(JSONArray response) {

I'm getting an empty array [] as response. All help is appreciated.

0

There are 0 best solutions below