- Home /
WWWform 'couldn't connect to host' on Standalone player
Hi people, I've been developing an interactive application at work, using a login system via php. I've setted up an Apache server on my machine, and the application works flawlessly. EXCEPT, when we try the app on other pc.
The logic is very simple, I send variables to a php script hosted internally, the php makes all the transactions with the Mysql database and print's the results. Easy.
The problem is, that no matter if I set a local Apache server (Which can be accessed via lan), or a server with a public domain, when I make a STANDALONE exe for my application, it doesn't connect.
At first, the php url was like http://192.168.1.13:8080/dev/unity/login.php , but when I noticed that other pc's couldn't connect to it VIA unity, I set it up on a public server like http://kevinseligmann.com.ar/dev/unity/login.php
The problem is the same, through unity editor it connects, but when making a standalone (NOT WEBPLAYER) it doesn't.
Here's my code:
function doLogin() {
var sHash = Md5Sum(strUsername+strPassword+sYourID);
var tURL = sURL;
tURL=tURL+"?mdwCMD=loginRequest";
tURL=tURL+"&user="+strUsername;
tURL=tURL+"&pass="+strPassword;
tURL=tURL+"&md5="+sHash;
var rLogin = WWW(tURL);
yield rLogin;
switch(rLogin.text) {
case "loginTrue":
Application.LoadLevel (1);
break;
case "loginFalse":
sLoginStatus = "Login Status: Failed, Please Try Again";
yield WaitForSeconds(3);
sLoginStatus = "";
break;
};
}
I also tried a simpler script, like:
function debugLogin(){
var w:WWW = new WWW (sURL);
yield w;
Debug.Log (w.text);
}
But on the output log of the standalone player, it clearly says "Couldn't connect to host".
So, anyone has any idea what this can be? Thanks in advance for your help.
Answer by kevinseligmann · Apr 17, 2012 at 10:00 PM
It had to do with the Crossdomain.xml file on the server. Never forget to put it as you will have the same problem!