Hello Steemit friends, so today I have learned will record down the PHP backend code and how we can call the backend API using POST method on 3 different language such as Javascript, Unity3D and PHP
So the PHP backend API code look like below where it take 2 input field via POST method and then query the database and then give out the output in JSON format
As you can see, in javascript we can use the XMLHttprequest to call the server API and it involve asynchronous call, so you have to wait for the call back on the .onreadystatechange to notify you that output is ready and you can display it on the console
for Unity3D, you can use the above code on the C# script, and due to it is also a Asynchronous call, thats why we need to use the StartCoroutine method to call the function which in turn will use the WWWForm to call the server API, and finally use the yield return to get the final output
And finally here is the way PHP way of calling the PHP server API by using the curl method where you must specify the CURLOPT_POSTFIELDS and also CURLOPT_RETURNTRANSFER = true