Question by
Geometrical · Oct 09, 2016 at 07:10 PM ·
unity 5loginwebrequestphp
WWWForm and WWW
Guys I'm doing the following:
void Start () {
StartCoroutine (Login ());
}
IEnumerator Login() {
WWWForm formData = new WWWForm ();
formData.AddField ("user", "asfas");
formData.AddField ("pass", "safas");
WWW webReq = new WWW ("http://www.mysite.com/register/login_body.php", formData);
yield return webReq;
Debug.Log (webReq.text);
}
<form method="post" action="index.php">
<input type="text" name="user" placeholder="Username">
<input type="password" name="pass" placeholder="Password">
<input type="submit" name="login" class="login loginmodal-submit" value="Login">
<a href="register.php">Register</a>
</form>
The php script displays two input boxes for username and password and there's a button to login. It prints out an error if the credentials are invalid. Currently my code is printing out the html code of this ui and not the result of the actual login ("login successful"). How do you do the whole wwwform and www thing when the php script has a ui?
Comment
Your answer
Follow this Question
Related Questions
Using POST and WebRequest in Unity 0 Answers
Finish UnityWebRequest before going further in Code 1 Answer
Using Facebook Login unity Pc Build 0 Answers