0

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

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. Because queries like this work:

echo file_get_contents('https://example.org');

Help me please. In which direction to dig?

And
  • 1
  • 2

1 Answers1

-1

in /etc/hosts file

127.0.1.1 example.com example

replaced by

external_ip of example.com example
And
  • 1
  • 2