Im trying to send this JSON Get request to a server from my Unity App:
http://192.168.100.54/api/seohardw/%7b%22uuid%22%3a%22b2d31111c283ab159aa3f503fe53bebe952cfe9c%22%2c%22model%22%3a%22Dell+System+XPS+L502X+(Dell+Inc.)%22%2c%22name%22%3a%22LAPTOYIIICWIN%22%2c%22os%22%3a%22Windows+7++(6.1.0)+64bit%22%7d
Which decodes to this request:
http://192.168.100.54/api/seohardw/{"uuid":"b2d31111c283ab159aa3f503fe53bebe952cfe9c","model":"Dell+System+XPS+L502X+(Dell+Inc.)","name":"LAPTOYIIICWIN","os":"Windows+7++(6.1.0)+64bit"}
From my computer works perfectly pressing play button on unity, but when i compile the app and download it into my android cellphone it doesn't work
This is my web routine:
IEnumerator SendSeoHardw()
{
string url = ServerURL + "seohardw/";
SeoFields SeoF = new SeoFields();
SeoF.uuid = SystemInfo.deviceUniqueIdentifier;
SeoF.model = SystemInfo.deviceModel;
SeoF.name = SystemInfo.deviceName;
SeoF.os = SystemInfo.operatingSystem;
json = WWW.EscapeURL(JsonUtility.ToJson(SeoF));
Debug.Log(url + json);
WWW www = new WWW(url + json);
yield return www;
json = www.text;
yield return null;
}
Any ideas on what can be happening?
Regards...
---- EDIT: -----
I just saw mi server logs and the requests doesn't look so different:
192.168.100.17 - - [08/Jul/2018:16:10:08 -0500] "GET /api/seohardw/%7b%22uuid%22%3a%22b2d31111c283ab159aa3f503fe53bebe952cfe9c%22%2c%22model%22%3a%22Dell+System+XPS+L502X+(Dell+Inc.)%22%2c%22name%22%3a%22LAPTOYIIICWIN%22%2c%22os%22%3a%22Windows+7++(6.1.0)+64bit%22%7d HTTP/1.1" 200 185 "-" "UnityPlayer/2018.1.4f1 (UnityWebRequest/1.0, libcurl/7.51.0-DEV)"
192.168.100.100 - - [08/Jul/2018:16:12:24 -0500] "GET /api/seohardw/%7b%22uuid%22%3a%224e9ba43ae60db57d979031c588a4ad38%22%2c%22model%22%3a%22samsung+GT-I9505%22%2c%22name%22%3a%22%3cunknown%3e%22%2c%22os%22%3a%22Android+OS+7.1.2+%2f+API-25+(NJH47F%2f41b3993b48)%22%7d HTTP/1.1" 404 736 "-" "Dalvik/2.1.0 (Linux; U; Android 7.1.2; GT-I9505 Build/NJH47F)"
---- EDIT 2: -----
I changed my routine to use UWR and the result is the same, my new routine is this:
IEnumerator SendSeoHardw()
{
string url = ServerURL + "seohardw/";
SeoFields SeoF = new SeoFields();
SeoF.uuid = SystemInfo.deviceUniqueIdentifier;
SeoF.model = SystemInfo.deviceModel;
SeoF.name = SystemInfo.deviceName;
SeoF.os = SystemInfo.operatingSystem;
json = WWW.EscapeURL(JsonUtility.ToJson(SeoF));
UnityWebRequest uwr = UnityWebRequest.Get(url + json);
uwr.SetRequestHeader("Content-Type", "application/json; charset=utf-8");
//Send the request then wait here until it returns
yield return uwr.SendWebRequest();
if (uwr.isNetworkError)
{
Debug.Log("Error While Sending: " + uwr.error);
}
else
{
Debug.Log("Received: " + uwr.downloadHandler.text);
}
}