1

file_get_contents isn't working when the url is from localhost (file_get_contents("http://localhost:9000")).

I tried file_get_contents(link to google) to test it and works perfectly.

also tried using the 127.0.0.1:9000 address and was not successful.

The same project hosted on a different url also works.

allow_url_fopen is on, extension=php_openssl.dll is enabled.

using:

"$domain = array(link to local host);"

or curl to load the url also does not work only on localhost.

PS: URLs can be accessed normally using browser.

Code on Controller: Code:

$my_var = file_get_contents('http://localhost:9000'); // timeout here only if localhost
var_dump($my_var);
die();

0 Answers0