0

I've been all day trying to make Volley work with my php session, I've tried all the examples on the web but I don't walk. (included this: Using cookies with Android volley library)

My PHP code is as simple as this:

<?php
require_once( $_SERVER['DOCUMENT_ROOT'] . "/session.php" );
$_SESSION["value"]++;
echo $_SESSION["value"]
?>

My Android code

StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
                            new Response.Listener<String>()
                            {
                                @Override
                                public void onResponse(String response) {
                                    // response
                                    Log.d(TAG,"Response" + response);
                                }
                            },
                            new Response.ErrorListener()
                            {
                                @Override
                                public void onErrorResponse(VolleyError error) {
                                    // error
                                }
                            }
                    ) 

My answer is always 1

I made my own methods to get and set Cookies into headers, but I also have the problem with multiple Set-Cookie (Android Volley, duplicate Set-Cookie is overridden)

Any suggestion?

Leonardo Javier
  • 89
  • 1
  • 2
  • 11

1 Answers1

0

You need use value of session_id() from php to Adnroid and the same value as session_id($_POST["session_id"]) from Android to php.