I am using
$url= "https://stackoverflow.com/questions";
$c = file_get_contents($url);
echo "hello".$c .' - '.$url;
to echo the content of external page on my page. This works fine on localhost but when I uploaded my page online the file_get_contents
function returns empty result and my page echos
Does anyone know why this is happening?
file_get_contents
only works with a URL rather than a filename if the PHP parameter allow_url_fopen = On
This parameter can only be changed in the php.ini
file or the httpd.conf
file. See List of php.ini directives
I assume it is not On
on your hosted live server. You could ask them to amend the config, but I assume you are on a cheap or free hosting package, so its unlikely as to get any useful features they will want you to upgrade to a chargable hosting package