加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

PHP:file_get_contents($loc)失败

发布时间:2020-05-25 09:55:47 所属栏目:PHP 来源:互联网
导读:我刚刚将一个项目从localhost移到我的远程服务器,并注意到我的一些脚本停止工作.最重要的是依赖于file_get_contents()从另一个脚本获取 JSON值. PHP版本是5.2.4 allow_url_fopen为ON Warning: file_get_contents() [function.file-get-contents]: php_network

我刚刚将一个项目从localhost移到我的远程服务器,并注意到我的一些脚本停止工作.最重要的是依赖于file_get_contents()从另一个脚本获取 JSON值.

PHP版本是5.2.4
allow_url_fopen为ON

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/2009/functions/functions.products.php on line 5

Warning: file_get_contents(http://data.example.com/new-data.php) [function.file-get-contents]: failed to open stream: Success in /var/www/html/2009/functions/functions.products.php on line 5

脚本正在从http://www.example.com运行
传入该函数的位置是http://data.example.com/new-data.php

注意:相同的域名,但两个不同的服务器.

function getData() {
  $location = "http://data.mysite.com/new-data.php";
  $contents = file_get_contents($location);
  $jsonVars = json_decode($contents);
  return $jsonVars
}

Name or service not known

DNS破了你可以从机器上的shell(假设你有)ping data.mysite.com吗?

现在尝试用固定的IP地址替换data.mysite.com.

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读