UnityWebRequest Post function doesn't work? [duplicate]












1
















This question already has an answer here:




  • Sending http requests in C# with Unity

    2 answers




I am trying to make a Post request using the UnityWebRequest class.
Everything works well if I use this:



IEnumerator Loginplayer_old()
{
print("Login");
WWWForm form = new WWWForm();
form.AddField("name", Login_Field_name.text);
form.AddField("password", Login_Field_Password.text);
WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
yield return www;
}


But if I use the Post function like this it doesn't work at all:



IEnumerator Loginplayer_old()
{
print("Login");
WWWForm form = new WWWForm();
form.AddField("name", Login_Field_name.text);
form.AddField("password", Login_Field_Password.text);

UnityWebRequest www = UnityWebRequest.Post("http://localhost/sqlconnect/register.php", form);

yield return www;
}


What should I do to get this working?










share|improve this question















marked as duplicate by Programmer unity3d
Users with the  unity3d badge can single-handedly close unity3d questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 18:34


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    1
















    This question already has an answer here:




    • Sending http requests in C# with Unity

      2 answers




    I am trying to make a Post request using the UnityWebRequest class.
    Everything works well if I use this:



    IEnumerator Loginplayer_old()
    {
    print("Login");
    WWWForm form = new WWWForm();
    form.AddField("name", Login_Field_name.text);
    form.AddField("password", Login_Field_Password.text);
    WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
    yield return www;
    }


    But if I use the Post function like this it doesn't work at all:



    IEnumerator Loginplayer_old()
    {
    print("Login");
    WWWForm form = new WWWForm();
    form.AddField("name", Login_Field_name.text);
    form.AddField("password", Login_Field_Password.text);

    UnityWebRequest www = UnityWebRequest.Post("http://localhost/sqlconnect/register.php", form);

    yield return www;
    }


    What should I do to get this working?










    share|improve this question















    marked as duplicate by Programmer unity3d
    Users with the  unity3d badge can single-handedly close unity3d questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 25 '18 at 18:34


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      1












      1








      1









      This question already has an answer here:




      • Sending http requests in C# with Unity

        2 answers




      I am trying to make a Post request using the UnityWebRequest class.
      Everything works well if I use this:



      IEnumerator Loginplayer_old()
      {
      print("Login");
      WWWForm form = new WWWForm();
      form.AddField("name", Login_Field_name.text);
      form.AddField("password", Login_Field_Password.text);
      WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
      yield return www;
      }


      But if I use the Post function like this it doesn't work at all:



      IEnumerator Loginplayer_old()
      {
      print("Login");
      WWWForm form = new WWWForm();
      form.AddField("name", Login_Field_name.text);
      form.AddField("password", Login_Field_Password.text);

      UnityWebRequest www = UnityWebRequest.Post("http://localhost/sqlconnect/register.php", form);

      yield return www;
      }


      What should I do to get this working?










      share|improve this question

















      This question already has an answer here:




      • Sending http requests in C# with Unity

        2 answers




      I am trying to make a Post request using the UnityWebRequest class.
      Everything works well if I use this:



      IEnumerator Loginplayer_old()
      {
      print("Login");
      WWWForm form = new WWWForm();
      form.AddField("name", Login_Field_name.text);
      form.AddField("password", Login_Field_Password.text);
      WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
      yield return www;
      }


      But if I use the Post function like this it doesn't work at all:



      IEnumerator Loginplayer_old()
      {
      print("Login");
      WWWForm form = new WWWForm();
      form.AddField("name", Login_Field_name.text);
      form.AddField("password", Login_Field_Password.text);

      UnityWebRequest www = UnityWebRequest.Post("http://localhost/sqlconnect/register.php", form);

      yield return www;
      }


      What should I do to get this working?





      This question already has an answer here:




      • Sending http requests in C# with Unity

        2 answers








      php unity3d http-post unityscript






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 11:46









      martin clayton

      65.5k17186180




      65.5k17186180










      asked Nov 25 '18 at 9:32









      Gobla GameGobla Game

      215




      215




      marked as duplicate by Programmer unity3d
      Users with the  unity3d badge can single-handedly close unity3d questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 25 '18 at 18:34


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Programmer unity3d
      Users with the  unity3d badge can single-handedly close unity3d questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 25 '18 at 18:34


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          3














          You have to send it if using UnityWebRequest, it is not automatic:



          yield return www.SendWebRequest(); // not simply yield return www





          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You have to send it if using UnityWebRequest, it is not automatic:



            yield return www.SendWebRequest(); // not simply yield return www





            share|improve this answer




























              3














              You have to send it if using UnityWebRequest, it is not automatic:



              yield return www.SendWebRequest(); // not simply yield return www





              share|improve this answer


























                3












                3








                3







                You have to send it if using UnityWebRequest, it is not automatic:



                yield return www.SendWebRequest(); // not simply yield return www





                share|improve this answer













                You have to send it if using UnityWebRequest, it is not automatic:



                yield return www.SendWebRequest(); // not simply yield return www






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 25 '18 at 9:47









                Yuri NudelmanYuri Nudelman

                1,3341612




                1,3341612















                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)