![]() ![]() Using (UnityWebRequest post = UnityWebRequest.Post(WWW. Using (UnityWebRequest get = UnityWebRequest.Get(testURL))įorm.AddField("username", username.text) įorm.AddField("password", password.text) Any ideas on what im doing wrong here? public IEnumerator LoginUser() The following code is sent once the player hits a login button. ![]() I'm using a test URL to make sure it was't an issue with the original. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) LoginHandler:CheckForNetworkErrors(UnityWebRequest) (atĬ_Iterator2:MoveNext() (at Assets/Scripts/LoginHandler.cs:92) The strange part is the Get is working fine, but the Post turns up the following Error : Cannot connect to destination host Network I'm trying to set up a login screen but I'm having troubling Posting to the server properly. So I think the problem must lie in the difference between a) executing the Coroutine with a reference to an URL string that is generated in the code (as in my initial setup, which didnt work) and b) executing the Coroutine with an URL in plain text (i.e.I'm familiar with Unity but new to trying to communicate with servers. 'postURL', while copying the URL that 'postURL' generates does get the desired result.īut obviously it then inserts the variables as defined in that instance, rather than the actual variables from the game at the moment the Coroutine is called. ID is indeed nullable, that works fine as well.ĭespite the empty return when I tried ur first suggestion, it didn't create a new row in my database.īasically, in my inital setup a working URL is created, but for some reason it won't work using the reference to In these cases, all fields get populated correctly. When I paste the generated URL in my browser, it creates a row in my database.Įven when I paste that URL in text in my code, rather than the reference to 'postURL', it creates a new row when the Coroutine is called. Im using phpmyadmin so I can see whether my entry works or not by simply refreshing and checking whether a new row was added. Thanks again for the reply and suggestions. $_GET has a url length limit(if your still using it), you're probably not in danger of reaching it but its always a possibility with how your server is setup. Cannot Connect to Destination Host I installed this game today and when I try to log in I receive a error called Cannot connect to destination host The author of this topic has marked a post as the answer to their question. What was your script with less variables that worked. If you remove | `id` |, from | MyTable (`id` |, you wouldn't need to insert null ![]() that's probability your key and might be a possible error. Is id Nullable? i see your trying to insert null into id. Is that your whole php script? if your using sessions you'll need a work around. Use print_r($_POST) to see if something is wrong.Įcho the sql result to see how many rows where updated.Įcho the sql string copy the string and use a php query in a editor like phpmyadmin or heidisql to see if it throws any errors when you manually try using that string. If only part of the data is being populated make sure your sql fields are correctly typed, sql is case sensitive. You only need to phrase things in unity, php will automatically phrase things correctly.(then again i dont know about bytes)Īn empty return is what you want correct? i dont see any errors and you dont have any echos I dont use bytes i phrase everything as a string, it should work either way but i only know that string works for me. The main difference with the test scenario is that in that case, I inserted the variables immediately in the StartCoroutine function whereas this function in my current situation is made up of variables (INT and FLOAT) that are defined elsewhere.įeel free to ask questions if necessary. This is stored in the same location as the code I used for the test with less variables (which worked) and is basically set up the same. The code that is supposed to be executed is php code. Also, when I copy the URL (test.text) in my browser it returns no errors, and when I remove 1 variable from the URL it gives a notice that it is missing that variable. This worked fine in a previous test with less variables. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |