Search Unity

UnityWebRequest return Unknow Error code 0

Discussion in 'Multiplayer' started by guzz, Dec 21, 2019.

  1. guzz

    guzz

    Joined:
    Dec 16, 2012
    Posts:
    5
    I write a very simple script to read the string from my website:
    Code (CSharp):
    1.  
    2.     void Start()
    3.     {
    4.         StartCoroutine(SendRequest());
    5.     }
    6.  
    7.     IEnumerator SendRequest()
    8.     {
    9.         UnityWebRequest uwr = UnityWebRequest.Get("https://www.gzztech.cn/");
    10.         yield return uwr.SendWebRequest();
    11.         if (uwr.isHttpError || uwr.isNetworkError)
    12.         {
    13.             Debug.Log(uwr.error + " " + uwr.responseCode);
    14.         }
    15.         else
    16.         {
    17.             Debug.Log("Get:Success");
    18.             string a = uwr.downloadHandler.text;
    19.             Debug.Log(a);
    20.         }
    21.     }
    22.  
    return error : "Unknown Error 0". the url just return a very simple string. I can open the page in any brower.
    what's the wrong?Thank you!

    Unity version : 2018.3.13f1
     
    Last edited: Dec 21, 2019
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Verify you can connect to a site with http instead of https first.