400 bad request doing everithing wright
I made a code and it returns me error 400 bad request but I printed the url and used in my explorer and it works so its a www(...) problem i dont understand is completely illogic. Here is the post_url:
localhost/fishPHPscripts/localaddscore.php?uniqueID=fb 115769435607315&name=James≻ore=15&hash=98562f5c7cff89eafa4b87501ca9700a
IEnumerator IPostScores ()
{
//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 = Md5Sum (name3 + actual_score + secretKey);
//string post_url = addScoreURL + "name=" + WWW.EscapeURL(name) + "&score=" + score + "&hash=" + hash;
string post_url = addScoreURL + "uniqueID=" + uniqueID + "&name=" + WWW.EscapeURL (name3) + "&score=" + actual_score + "&hash=" + hash;
print (post_url);
// Post the URL to the site and create a download object to get the result.
WWW hs_post = new WWW ("http://"+post_url);
yield return hs_post; // Wait until the download is done
if (hs_post.error != null) {
print ("There was an error posting the high score: " + hs_post.error);
}
}
Answer by kristianharge · Mar 12, 2017 at 10:31 AM
after thinking, i change my score int into a string and ad www.escape to each variable, it solved my problem:
string post_url =addScoreURL+"uniqueID="+WWW.EscapeURL(uniqueID)+"&name="+WWW.EscapeURL(name3)+"&score="+WWW.EscapeURL(actual_score.ToString())+"&hash="+WWW.EscapeURL(hash);
Your answer
Follow this Question
Related Questions
Having Trouble with Post to Server 0 Answers
Unity3D - Parse Migration 0 Answers
UnityWebRequest.Post() has multipart/form-data strangely formatted when sending request 5 Answers
[WEBGL] Post json - complicated structure 0 Answers
POST request to RESTful APIs 0 Answers