我正在从 localhost (http://172.16.65.1/) 上的 OSX 上的 MAMP 服务器上处理我的网站。
我想从 Google 加载一些 JSON,一些简单的测试表明我在这里遇到了问题。
echo file_get_contents("http://www.google.com"); // FAILS
// PHP log: [07-Dec-2011 23:09:21] PHP Warning: file_get_contents(http://www.google.com) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Host is down in /Applications/MAMP/htdocs/-tests/get-json.php on line 3
echo file_get_contents("http://www.yahoo.com"); // FAILS
// echo file_get_contents("http://localhost"); // WORKS
// echo file_get_contents("http://172.16.65.1/"); // WORKS - My MAMP server
对此我能做什么?
它在我的主机提供商服务器上运行良好。
您还需要办理登机手续PHP.ini
file
extension = php_openssl.dll
是否启用,如果没有,则只需通过删除来启用它;符号
allow_url_fopen = on
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)