Monday 27 February 2012

PHP Fix: file_get_contents Not Working

If you are try to load contents of a page using the following functions you maybe suprised to find it not working.


$page =urldecode ($_POST["url"]);
$file = file_get_contents($page, true);
echo rawurlencode($file);

I order to make it work you need to add a file within the folder where the php script is sitting. This file is called 'php.ini'.

In this file add the following line to enable you to use the function above:

allow_url_fopen = On

Thats it!


No comments:

Post a Comment