Unity5 - WWWForm issues

Hi!
I have simple example for web player.

public void OnButtonClick() {
  StartCoroutine(Request());
}

IEnumerator Request() {
  WWWForm form = new WWWForm();
  form.AddField("param", 0);

  WWW www = new WWW("http://www.domain.com/query.php", form);
  yield return www;

  Debug.Log(www.error);
  Debug.Log(www.text);
}

This code worked correctly in 4.6.x (for all browsers). But now there are some issues:

  1. It’s ok in Google Chrome
  2. I get an www.error in Firefox: Failed to downloading http://www.domain.com/query.php
  3. There is no www.error in Safari, but PHP-script says that he doesn’t receive any POST params.

If I change request to GET params, it’s all ok:

WWW www = new WWW("http://www.domain.com/query.php?param=0");

What’s wrong with POST?

Thanks!

Struggled good few hours on that couple weeks ago,
POST worked fine in editor, but not in the webplayer…

Solution was to set WWWForm.headers, there was example in forums or answers somewhere…

I have the same problem. What informations shall be set in the header?

i had this:

var headers = form.headers;
headers["Content-Type"] = "application/x-www-form-urlencoded";

then its used at:

WWW www = new WWW(url,form.data,headers);

Unfortunately this didn’t fix my problem. :frowning:

Add one binary field to your WWWForm:

wwwForm.AddBinaryData("binary", new byte[1]);

Now everything should work.