4

I use WWWForm, It's not working with ssl connection,

if I use http:// connection on secure domain it doesn't send POST variable and if I use https:// it given error

unknown error

So it just working and send variable only non-secure domain

Unity3d version is 2017.3.0p1

I tried windows and mac version

Here is 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 returns only test.

Here is test.php :

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

Please assist on me, what should I do?

5
  • Try putting 'http://' at the beginning of your URL. Commented Jan 5, 2018 at 13:43
  • @BrandonMiller I tried, but its not working Commented Jan 5, 2018 at 14:29
  • What's the output if you print a var_dump of $_REQUEST? Commented Jan 10, 2018 at 23:58
  • Here is the var_dump output array(0) {} @Demigod Commented Jan 11, 2018 at 7:46
  • It's good practice to use only <?php instead of <?. Then, how do you debug it? Are you checking the Debug.Log(w.text) data? Commented Jan 11, 2018 at 8:46

1 Answer 1

3
+50

It seems like a bug in Unity version 2017.3.0. If you post data to a url hosted in a server using SSL and set to rewrite/re-direct all, it returns unknown error.

I believe it will be fixed soon, but you could consider to switch to version 5.3.8 to surpass this issue until it's fixed.

Sign up to request clarification or add additional context in comments.

1 Comment

yeah that's right! I have uninstalled 2017.3.0 and installed 5.3.8 it's worked! it's not completely solution but it solved my problem for now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.