Well… that’s it.
If I have
string call = “me”;
UnityWebRequest.Get(“www.domain.com/call?= ” + call)
works with no problem.
but if I do:
string domain = “domain”;
UnityWebRequest.Get(“www.” + domain + “.com/call?=” + call)
It just start throwing certificate error issues.
Any way to do those
www.certificateHandler = new WebRequestCert();
in game?
FranFndz:
Well… that’s it.
If I have
string call = “me”;
UnityWebRequest.Get(“www.domain.com/call?= ” + call)
works with no problem.
but if I do:
string domain = “domain”;
UnityWebRequest.Get(“www.” + domain + “.com/call?=” + call)
Post the exact code you tested (with code tags) and the exact error message you’re getting.
Get() only sees the final string that you actually pass to it, not the steps that you used to create that string, so it can’t possibly be behaving differently based on how you created the string. There has to be some difference other than that.
Certificate errors suggest to me that you’re accessing a different web site between the two test cases. Spelling error in the URL, maybe?
If you’re really convinced you’re using identical strings, then try comparing the two strings in code.
Are you also missing https:// from your examples?
Nop. Will post code later.
I even debug the URI, copy the console link.ñ, Paste in browser and no problem.
I also thought about misspelling so I did super simple test like:
“https://www .” + domain + “.com/call”…
by the way; the domain string is set using a stringbox in canvas (dynamic, user input )
May be some very simple human error.
Will copy the code ASAP!
ok, this is simple Github using my server for test
https://github.com/resetme/Unity_WebRequestError
I also have tried making the certificate return alway True, but it still give me error (server error)
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
public class WebRequestTest : MonoBehaviour
{
public TextMeshProUGUI keyLabel;
public TextMeshProUGUI domainLabel;
public TextMeshProUGUI consoleKey;
public TextMeshProUGUI consoleDomain;
public void TestKeyCall()
{
StartCoroutine(PingServer(0));
}
public void TestDomainCall()
{
StartCoroutine(PingServer(1));
}
private IEnumerator PingServer(int value)
{
string createUrl = string.Empty;
switch (value)
{
case 0: // Test Key
createUrl = "https://franfndz.com/Unity/pingResponse.php?appView=" + keyLabel.text;
break;
case 1: // Test Domain // Will give Error
createUrl = UnityWebRequest.UnEscapeURL("https://" + domainLabel.text + ".com/Unity/pingResponse.php?appView=domainTest");
break;
}
Debug.Log(createUrl);
if (string.IsNullOrEmpty(createUrl))
yield break;
string answer = string.Empty;
using (UnityWebRequest www = UnityWebRequest.Get(createUrl))
{
www.SendWebRequest();
while (!www.isDone)
{
yield return new WaitForEndOfFrame();
}
answer = createUrl;
answer += "\n";
if (www.isNetworkError)
{
answer += www.error;
}
else
{
answer += www.downloadHandler.text;
}
}
switch (value)
{
case 0: // Test Key
consoleKey.text = answer;
break;
case 1: // Test Domain
consoleDomain.text = answer;
break;
}
}
}
google a little more I found this;
Regex.Replace(createUrl, @“[^\u0000-\u007F]+”, string.Empty);
Now is working from dynamic text input.