Does anyone know if Unity supports PHP sessions?
For example, let's say that a user signs into their account in Unity and submits the login information through WWW stream. Once logged in, I assign a session variable in my php script: $_SESSION['name]=name.
My question is, when the user comes to submit another request through Unity will the client still be able to access the session variable?
Session data are data from a database connected to an id, which is used in the communication between client and server. Usually a cookie.
I can't say for certain, but I very much believe that the WWW class will ignore/forget cookies.
PLEASE NOTE: I have not tested this, it is theoretical, but educated, guesses.
You can set headers in your request that you build in Unity. If you save the headers from the response and add those to the request each time, you should be able to emulate the behaviour you're seeking. So basically:
You set headers by doing something like this:
var headers = new Dictionary<string,string>();
headers.Add("Cookie", "key=value; semicolon=separated");
WWW www = new WWW("https://example.com", null, headers);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With