有没有人使用unitywebrequest在外部页面上进行身份验证,我不是管理员?我试图使用unity3d文档的例子,但它没有用,任何人都会有一些例子
做这样的事情。
public void Start()
{
StartCoroutine(Login());
}
private static IEnumerator Login() {
UnityWebRequest www = UnityWebRequest.Post(
$"{WebUrl}login",
new List<IMultipartFormSection> {
new MultipartFormDataSection("username", "name"),
new MultipartFormDataSection("password", "pass"),
}
);
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
}
else {
foreach (var s in www.GetResponseHeaders()) {
Debug.Log("s=" + s);
}
}
}