Search code examples
phpjsonweb-servicesfile-get-contentsdatasnap

file_get_contents returns empty string in shared host


I'm trying get url contents with file_get_contents(), its works in my localhost server, but in shared host server, the function returns a empty string, without errors. My code follows:

$uri = 'http://my_url.com:81/datasnap/rest/TServerMethods/getLoginCliente/galf/123/';
$result = file_get_contents($uri);
var_dump($result);

and the result is:

string(0) ""

instead of:

{result: [4532,1]}

I'm test change the url for google.com, and works perfectly.

Anyone know why this happens?


Solution

  • the problem is the firewall host. The firewall is block the port 81.