0

I am trying to send POST data from Unity to PHP server.

C#:

    WWWForm form = new WWWForm();
    form.AddField("playerName", "myName");
    using (UnityWebRequest www = UnityWebRequest.Post("https://myserver.com/savedata.php", form))
    {
        yield return www.SendWebRequest();
        
        if (www.result != UnityWebRequest.Result.Success)
        {
            Debug.Log(www.error);
        }
        else
        {
            Debug.Log(www.downloadHandler.text);
        }
    }

In PHP, $_POST is empty and $_REQUEST is empty. I tried everything I could find online. What could possibly be going on?

1 Answers1

1

It worked when I added "www." in front of url!