[英]failed to open stream: Cannot assign requested address
I am using code like this:我正在使用这样的代码:
echo file_get_contents('https://example.com/file.txt');
In response I get an error:作为回应,我收到一个错误:
Warning: file_get_contents( https://example.com/file.txt ): failed to open stream: Cannot assign requested address in /sites/example.com/test.php on line 2
警告: file_get_contents( https://example.com/file.txt ):无法打开流:无法在第2行的 /sites/example.com/test.php 中分配请求的地址
As I understand it, the server for some reason forbids accessing the file_get_contents () function if the file is located on the same server.据我了解,如果文件位于同一服务器上,则服务器出于某种原因禁止访问 file_get_contents () 函数。 Because queries like this work:
因为这样的查询有效:
echo file_get_contents('https://example.org');
Help me please.请帮帮我。 In which direction to dig?
往哪个方向挖?
in /etc/hosts file在 /etc/hosts 文件中
127.0.1.1 example.com example
replaced by取而代之
external_ip of example.com example
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.