using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
public class ButtonsHandler : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
StartCoroutine(GetRequest("https://www.kinówki.pl"));
StartCoroutine(GetRequest("https://www.xn--kinwki-dxa.pl"));
}
// Update is called once per frame
void Update()
{
}
IEnumerator GetRequest(string uri)
{
using (UnityWebRequest webRequest = UnityWebRequest.Get(uri))
{
// Request and wait for the desired page.
yield return webRequest.SendWebRequest();
string[] pages = uri.Split('/');
int page = pages.Length - 1;
if (webRequest.isNetworkError)
{
Debug.Log(pages[page] + ": Error: " + webRequest.error);
}
else
{
Debug.Log(pages[page] + ":\nReceived: " + webRequest.downloadHandler.text);
}
}
}
}
The code looks good. It seems the second URI redirects to first, try debugging the request using tools like Fiddler or Charles.
I can only guess that the special character causes the problem due to encoding or something like that.
UnityWebRequest has ability to attach SertificateHandler that would trust any website. Such alternative also exists in .NET APIs.
However I’m not sure this will help you. This has to be certificate issue in the first place. Have you tried Fiddler?
I have the same issue with error log UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED
Charles does not easily want to track SSL website calls from Unity applications due to a certificate error. This is a very common tool to track server calls (though not sure on SSL sites) so unfortunate, but maybe someone has the solution