Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by boolpae · Jul 04, 2011 at 12:06 PM · wwwwww classweb server

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~~~

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Waz · Jul 04, 2011 at 12:15 PM 1
Share

Share the love: format your code using the 101-010 button.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Waz · Jul 04, 2011 at 12:14 PM

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?

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image boolpae · Jul 04, 2011 at 12:21 PM 0
Share

Thank you~ Warwick Allison ^^

I want to use web-server session. Because... If user did loign, web-server session have(store) user's infomation.

what can i use for communicating with web-server?

avatar image Graham-Dunnett ♦♦ · Jul 04, 2011 at 12:25 PM 1
Share

http://en.wikipedia.org/wiki/REST

avatar image Waz · Jul 04, 2011 at 01:18 PM 0
Share

Ya web-weenie, Graham ;-)

avatar image
2

Answer by Bunny83 · Jul 04, 2011 at 12:34 PM

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...

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image boolpae · Jul 04, 2011 at 12:40 PM 0
Share

Thank you. Bunny83~

Please tell me reference URL or document ^^

avatar image Bunny83 · Jul 04, 2011 at 01:16 PM 0
Share

Well, as i said the responseHeaders is undocumented. If you have Visual Studio you should have no problems to use it ;). It's just a Hashtable that contains all header fields.

Besides that you should take a look at the PHP manual especially the section about Passing the Session ID

avatar image boolpae · Jul 05, 2011 at 10:28 AM 0
Share

Thank you for help.^^ I am trying to solve this problem. (I think.... I can do it~)

Have a nice day~~~

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Game object to prefab problem 0 Answers

Get session of web application by web player 0 Answers

API with Key Headers required 0 Answers

How to use POST service using www class? 0 Answers

WWW.text length of a string in Unity3d populated ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges