WWW standalone. (why changed web server session?)

I have one question. ^^

  1. I make unity standalone version.
  2. and make Web server (php+mysql).

if click client button, unity client communicate with web server.

Client source


WWW www ;

switch ( button_number )

   case 0 :
   
       String strUrl2 = String.Format("http://mydomain.com/WebPlayer.php?mode=Login&id=xxx&pass=xxx");
       www = new WWW(strUrl);

   case 1 :  
   
       String strUrl2 = String.Format("http://mydomain.com/WebPlayer.php?mode=Myinfo&id=xxx");
       www = new WWW(strUrl);

   case 2 :  
   
       String strUrl2 = String.Format("http://mydomain.com/WebPlayer.php?mode=Rankinginfo&id=xxx");
       www = new WWW(strUrl);
   
//

If click button_number 0 → call “Login” to Web server.
If click button_number 1 → call “Myinfo” to Web server…

It is correctly work.
BUT…
session of php web server is changed.

Whenever call web server, server session is changed.

Why change web-server session ??

Please help me~~~

Unity WWW is not stateful, so you need non-stateful protocols (“REST” those web-weenies call it). Are you trying to use a session cookie or something like that?

You can either use the yet undocumented responseHeaders hashtable of the www class to get the Set-Cookie header after login and set the Cookie header with the session id each subsequent call.

The other way is to use an URI sessionID. Just pass the sessionID back to Unity when login, store it, and add an additional URI parameter: PHPSESSID=XXXXX for subsequent calls. PHP is that smart enough ;).

I guess the responseHeaders aren’T documented yet since a hashtable doesn’t meet the http specs. A http header can be included multiple times in one response, the hashtable however overrides similar fields of course…