I'm trying to get data from a remote server using C#. I tried using a simple script to see if "it works", but I'm not getting a response. The same script works on a local server, so I'd like to know how I can do it.
This is my C# code:
IEnumerator Sayhi()
{
WWWForm sendInfo = new WWWForm();
sendInfo.AddField("function", function);
WWW www = new WWW(bl_LoginDataBase.Instance.GetUrl(bl_LoginDataBase.URLType.CallFunction), sendInfo);
yield return www;
Debug.Log(www.text);
}
And the PHP code:
<?php
echo "Hi";
I expected the Debug.Log(www.text);
to print Hi
, which it does if I use a local machine (http://192.168.0.whatever
), but the remote server (http://whatever.example.com
) doesn't return anything. I tried making the php fail so it returns an error, make a database and return some values from there, but nothing. I'd like to point out it does work on a local server, and works as intended.
What am I doing wrong?
Edit: By the way, if I access http://www.whatever.example.com/Function.php
via browser, it shows the echo
result.