Question by
DutchGuerrilla · Nov 25, 2016 at 10:14 AM ·
networkingnetwork.connect
4G network versus wifi network post www php mysql data
Hello Guys,
I made a function for posting data by www to a PHP script, but it seems to fail when I switch from wifi to 4g mobile network provider. My function is as follows:
StartCoroutine(PostScores(Convert.ToInt64(FBProfile.ProfileId), FBProfile.FirstName, persistentDataScript.score, persistentDataScript.lastLevel));
IEnumerator PostScores(Int64 facebookId, string name, int score, int levelId)
{
string oneSignalUserId = PlayerPrefs.GetString("OneSignalUserId");
//string oneSignalUserId = "802ca4bc-74d7-11e5-b486-13d20ae9ed32";
//This connects to a server side php script that will add the name and score to a MySQL DB.
// Supply it with a string representing the players name and the players score.
string hash = MyFunctions.Md5Sum(oneSignalUserId + facebookId + name + score + levelId + secretKey);
string post_url = addScoreURL + "onesignaluserid=" + oneSignalUserId + "&facebookid=" + facebookId + "&name=" + WWW.EscapeURL(name) + "&score=" + score + "&levelId=" + levelId + "&hash=" + hash;
Debug.Log(post_url);
// Post the URL to the site and create a download object to get the result.
WWW hs_post = new WWW(post_url);
yield return hs_post; // Wait until the download is done
if (hs_post.error != null)
{
Debug.Log("There was an error posting the high score: " + hs_post.error);
errorPanel.SetActive(true);
}
else
{
uploadScorePanel.SetActive(false);
}
}
public void OnErrorYesClick ()
{
Application.LoadLevel(Application.loadedLevelName);
}
It gives my error panel again and again. Someone experienced this issue and know a way around?
Thanks, Maarten
Comment