【发布时间】:2010-11-19 13:44:12
【问题描述】:
我正在使用file_get_contents 函数将 URL 转换为字符串:
$contents = file_get_contents("http://google.com");
但是,我收到以下错误:
file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known.
如何在我的本地主机中解决这个问题?
【问题讨论】:
-
我认为这可能是 DNS 或防火墙问题。你能检查一下你是否可以从那个主机
ping google.com? -
ping google.com在命令行中工作但遇到同样的问题。
标签: php networking