【发布时间】:2011-09-26 22:34:01
【问题描述】:
我在我的 PHP 上使用 file_get_contents,它会抛出一些错误:
我的代码
#try to fetch from remote
$this->remotePath = "http://some-hostname.com/blah/blah.xml
$fileIn = @file_get_contents($this->remotePath);
错误:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /virtual/path/to/file/outputFile.php on line 127
Warning: file_get_contents(https://some-host-name/data/inputFile.xml) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /virtual/path/to/file/outputFile.php on line 127
有什么想法吗?它在我的计算机上运行良好,但在我将其移植到网络服务器时停止运行。
【问题讨论】:
-
顺便说一句,既然要加载xml,请在设置allow_url_fopen后使用simplexml_load_file函数。
标签: php file-get-contents