Unity PHP Post does not send POST variable

I use WWWForm, it does not work with ssl connection,

If I use a connection http://in a secure domain, it does not send the POST variable, and if I use https://, it gives an error

Unknown error

So it just works and sends the variable only to the unsecured domain

Unity3d Version - 2017.3.0p1

I tried windows and mac version

Here is the C # code:

    WWWForm form = new WWWForm();


    form.AddField("a", "var1");
    form.AddField("b", "var2");
    string url = "http://www.example.com/ajax/test.php";

    WWW w = new WWW(url, form);
    yield return w;
    if (!string.IsNullOrEmpty(w.error)) {
        Debug.Log(w.error);
    }
    else {
        Debug.Log(w.text);
   }

It only returns test.

Here is test.php:

<?
echo 'test '.$_POST["a"];
?>

Please help me, what should I do?

+4
source share
1 answer

, Unity 2017.3.0. URL-, SSL rewrite/re-direct all, unknown error.

, , 5.3.8, , .

+3

Source: https://habr.com/ru/post/1691788/


All Articles