现在这让我有点挠头。
我正在尝试从远程 URL 获取文件。我可以保存本地文件的内容,但不能保存远程文件的内容。
这有效:
file_put_contents(
'file1.xml',
file_get_contents('file2.xml')
);
这不会:
file_put_contents(
'file1.xml',
file_get_contents('http://www.domain.com/xmlapi/search.aspx?query=places&lid=38')
);
奇怪的是,我的其他脚本第一次尝试时工作正常,但现在没有一个可以访问远程 URL。
我最近开始在 Heart Internet 上托管我的新 php 文件。我在其他服务器上有类似的脚本,根本没有任何问题。
这是我得到的错误:
警告: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo 失败: 第 5 行 /home/sites/mydomain/myfile.php 中的名称或服务未知`
警告:file_get_contents() [function.file-get-contents]: 无法打开流: php_network_getaddresses: getaddrinfo 失败: 第 5 行 /home/sites/mydomain/public_html/myfile.php 中的名称或服务未知`
allow_url_fopen
被设定为On
不同领域
检查 PHP 设置...
这可能是由于安全问题...“allow_url_fopen = On”
http://www.php.net/manual/en/function.file-get-contents.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)