Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Anathaerine · Apr 28, 2015 at 06:44 AM · phpwwwformcrossdomain

WWWForm/Communication issue despite having a valid crossdomain.xml

Hi folks,

I have a conundrum that I can't seem to solve and searching around didn't yield any solutions.

I'm trying to save my user's game data to a database that's stored online. I have added a crossdomain.xml pretty much everywhere (including the root, the public_html/www folders). I tried various versions of the crossdomain.xml file as I found various solutions online. Currently the file looks like this:

 <?xml version="1.0" encoding="UTF-8"?>
 <cross-domain-policy>
 <allow-access-from domain="*" secure="false"/>
 </cross-domain-policy>

Ok, now I'm trying to post my data with a POST request and the code looks something like:

     string saveURL = "http://<myIP>/addSaveGame.php";
     
     WWWForm form = new WWWForm();
     form.AddField("username", username);
     form.AddField("gameData", saveCode );
     
     WWW s_post = new WWW(saveURL, form);
     yield return s_post; 
     
     if (s_post.error != null)
     {
         StartCoroutine(AddNotification(NOTIF_EVENT,"There was an error posting the save: " + s_post.error));
         print("There was an error posting the save: " + s_post.error);
     }
     else{
         print("save posted!");
         StartCoroutine(AddNotification(NOTIF_EVENT,"Save posted:"+username+"\n"+saveCode));
     }
 }    

I removed some of my sensitive data from the code but that's the gist of it and it works well when testing from the editor (my save gets posted, the database is updated). However, when publishing the game and testing it from either:

  • my computer

  • uploading it on my server and testing from there

  • uploading it to the website where I want the game to actually be and testing it

nothing happens...the game returns the "save posted" notification, indicating that s_post.error is null but my database isn't getting updated.

Am I missing something really obvious here? Should I be looking for something else? Is it possible that I'm getting a crossdomain.xml error despite s_post.error returning no error?

Thank you very much for reading over this!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Anathaerine · Apr 28, 2015 at 08:31 AM

In the meanwhile I have found the answer, so I'm coming back to resolve my own issue, maybe it'll help someone else as well. The issue appears to be totally unrelated to access and it is linked with the WWWForm itself. Solution is here: http://answers.unity3d.com/questions/917515/unity5-webplayer-wwwform-problem.html?sort=oldest

and it seems to have worked for me! Goes to show sometimes I'm just looking for the problem in the wrong place

Comment
Add comment · 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

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

2 People are following this question.

avatar image avatar image

Related Questions

Read second Line of WWWForm.data 1 Answer

Using https and SSL 1 Answer

Unity WWWForm causes php script to create new session? 1 Answer

How to format data returned from Mysql? 0 Answers

Why isn't this $_POST working properly? 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