PDA

View Full Version : file_get_contents checking?



MrCraig
14-11-2007, 02:44 PM
How would you check is file_get_contents is enabled?

so far ive got


if(!file_get_contents())
die("Sorry, BLABLABLA");


But its returning this error..



Warning: file_get_contents() expects at least 1 parameter, 0 given in /home/habcent/public_html/user/func.php on line 14


Sorry, File_Get_Contents MUST be enabled to use this script.



Ty.

DeejayMachoo$
14-11-2007, 03:44 PM
in the php stats page and ...


Sorry, File_Get_Contents MUST be enabled to use this script.

Im guessing its disabled

MrCraig
14-11-2007, 03:53 PM
no its not disabled, script isnt working..

And yh, i know in the php stats page phpinfo() and all that, But thats not what im asking.

Im trying to make a script that will 'die' if file_get_contents is disabled.

Invent
14-11-2007, 05:36 PM
<?php

if(!function_exists("file_get_contents"))
{

die("Sorry, BLABLABLA");

}

?>

lolwut
14-11-2007, 07:04 PM
You could make it go and look for a file on your server; make a text file with some data in it, then add this code somewhere:

<?php
error_reporting(0); //Turns off the errors that PHP churns out.
if(!file_get_contents("http://rh4u.co.uk/datafile.txt"){ //If their server can't get the contents of the datafile.txt file...
echo("file_get_contents() must be activated to use this!"); //...it says so.
exit; //Stops any other code from being executed
}
?>

Invent
14-11-2007, 07:18 PM
At above, read above :P

rh4u
14-11-2007, 10:01 PM
You could make it go and look for a file on your server; make a text file with some data in it, then add this code somewhere:

<?php
error_reporting(0); //Turns off the errors that PHP churns out.
if(!file_get_contents("http://rh4u.co.uk/datafile.txt"){ //If their server can't get the contents of the datafile.txt file...
echo("file_get_contents() must be activated to use this!"); //...it says so.
exit; //Stops any other code from being executed
}
?>

lolz xD thankyews for using mys domain :P
wont that show the error if it is enabled?

QuickScriptz
15-11-2007, 12:29 PM
<?php
if(file_get_contents("http://www.google.com")){
echo 'It works!';
}else{
echo 'Nope, sorry.';
}
?>

MrCraig
15-11-2007, 03:54 PM
Ty all :)

Il + REP if i can =]

Want to hide these adverts? Register an account for free!