file_get_contents在共享主机中返回空字符串 [英] file_get_contents returns empty string in shared host

查看:152
本文介绍了file_get_contents在共享主机中返回空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用file_get_contents()获取url内容,它在我的本地主机服务器中有效,但是在共享主机服务器中,该函数返回一个空字符串,没有错误.我的代码如下:

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);

结果是:

string(0) ""

代替:

{result: [4532,1]}

我正在测试更改google.com的网址,并且效果很好.

有人知道为什么会这样吗?

Anyone know why this happens?

推荐答案

问题是防火墙主机.防火墙阻止了端口81.

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

这篇关于file_get_contents在共享主机中返回空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆