public string url = "http://my.ip.address.221/betsinplay.txt"; //
private bool isDownloaded;
private string downloadedText;
IEnumerator Checkforbetsinplay()
{
using (UnityWebRequest www = UnityWebRequest.Get(url))
{
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
downloadedText = www.downloadHandler.text;
isDownloaded = true;
// Check downloadedText for true or false
if (downloadedText.ToLower() == "true")
{
// Do something if the value is true
Debug.LogError("BETSINPLAY IS TRUE");
}
else if (downloadedText.ToLower() == "false")
{
// Do something if the value is false
Debug.LogError("BETSINPLAY IS FALSE");
}
else
{
// Handle unexpected values
Debug.LogError("Downloaded text format not recognized (expected 'true' or 'false')");
}
}
else
{
Debug.LogError("Download failed: " + www.error);
}
}
}
when I try to run it, i get the following error: Curl error 1: Protocol "htttps" not supported or disabled in libcurl
now why in the world would it point to a non existant “htttps” protocol? My webserver does redirect http requests to htttps but in the web browser it does so fine without errors,what gives?
Really that code produces that error?? why would it have 3ts, it also isnt asking for https, so, it doesnt seem that this would be it… What sounds more likely is http hasnt been enabled in the project build choices.
Yes you can switch it to allowed but it‘s like embedding your webserver password in the executable from a security point of view, so not really an option.
So, I need a way to bypass valid SSL certificate, i can’t get a vaid one as it won’t have a domain name, only an IP address, using this code:
public class CertificateBypass : CertificateHandler
{
protected override bool ValidateCertificate(byte[] certificateData)
{
return true;
}
}
works, but only for SendPostRequest(), when I try this method for UnityWebRequest.Get() I get the same error:
Curl error 1: Protocol “htttps” not supported or disabled in libcurl
EDIT: with this version of the code:
private bool isDownloaded;
private string downloadedText;
IEnumerator Checkforbetsinplay()
{
using (UnityWebRequest www = UnityWebRequest.Get("https://my.ip/betsinplay.txt"))
{
www.certificateHandler = null;
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.Success)
{
downloadedText = www.downloadHandler.text;
isDownloaded = true;
// Check downloadedText for true or false
if (downloadedText.ToLower() == "True")
{
// Do something if the value is true
Debug.LogError("BETSINPLAY IS TRUE");
}
else if (downloadedText.ToLower() == "False")
{
// Do something if the value is false
Debug.LogError("BETSINPLAY IS FALSE");
}
else
{
// Handle unexpected values
Debug.LogError("Downloaded text format not recognized (expected 'true' or 'false')");
}
}
else
{
Debug.LogError("Download failed: " + www.error);
}
}
}
I’ve made some progress:
Curl error 60: Cert verify failed. Certificate is not correctly signed by a trusted CA. UnityTls error code: 7