【发布时间】:2015-04-13 10:43:02
【问题描述】:
我正在使用 Cakephp 2.6.1,我想使用外部 api。为此,我必须请求这样的网址:
$json = file_get_contents($url);
$data = json_decode($json);
我尝试使用 file_get_contents、curl 和 HttpSocket。我有那个错误:
php_network_getaddresses: getaddrinfo failed: Name or service not known
我检查php_info(); and allow_url_fopen 是否开启。
提前感谢任何能给我一些想法的人。
【问题讨论】:
-
Google search results 没有任何帮助?
-
提交帖子更容易寻找一点...问题似乎来自allow_url_fopen,但对我来说不是:/我不明白。
-
你是在服务器还是本地机器上?
-
我在服务器上。该代码在 php 框架之外不再工作......编辑:它看起来像一个 DNS 问题。有人帮我解决吗?
标签: php api cakephp curl file-get-contents