I contact the Unity community to find a problem with my problem.
I want to make a connection to a php my admin
the passage on Unity failed me against a problem here is my code
Please how to fix!
Assets\c# scripts\ID_Login.cs(24,17): warning CS0618: 'UnityWebRequest.isNetworkError' is obsolete: 'UnityWebRequest.isNetworkError is deprecated. Use (UnityWebRequest.result == UnityWebRequest.Result.ConnectionError) instead.'
Assets\c# scripts\ID_Login.cs(24,39): warning CS0618: 'UnityWebRequest.isHttpError' is obsolete: 'UnityWebRequest.isHttpError is deprecated. Use (UnityWebRequest.result == UnityWebRequest.Result.ProtocolError) instead.'
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class ID_Login : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
StartCoroutine(Login("ahmed", "amine.chehab"));
}
IEnumerator Login(string username, string password)
{
WWWForm form = new WWWForm();
form.AddField("LoginUser", username);
form.AddField("LoginPass", password);
using (UnityWebRequest www = UnityWebRequest.Get("http://localhost/unity_game_server/login.php", form))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log(www.downloadHandler.text);
}
}
}
}