- Home /
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!
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
Your answer
Follow this Question
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