vendredi 20 février 2015

WWW class "couldn't connect to host"

After research, I decided to use PHP to send mail via Web player app, since you can't use System.net.mail on this platform.


On the php side, everything is fine, I use swift mailer and the gmail smtp. When the file is hosted and I call it via a browser it works fine & send the mails.


I host my web app on the same server, here's my C# code to call the php script :



public string phpUrl = "myAdress/sendMail.php";

public void SendMail ()
{
StartCoroutine(loadPhpMail());
}

private IEnumerator loadPhpMail()
{
WWW postPhp = new WWW (phpUrl);
yield return postPhp;

if (postPhp.error != null)
{
Debug.Log("error : "+postPhp.error);
}
else
{
if (postPhp.text=="true")
{
Debug.Log("success");
}
}
}


And the line "Debug.Log("error : "+postPhp.error);" returns "error : couldn't connect to host".


I did my research work, and couldn't find a workaround. I tried some things like add a crossdomain policy to the serv.


Thank's guys for reading this. Bye !





Aucun commentaire:

Enregistrer un commentaire