Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default file_get_contents checking?

    How would you check is file_get_contents is enabled?

    so far ive got
    PHP Code:
    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.
    Coming and going...
    Highers are getting the better of me

  2. #2
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    in the php stats page and ...

    Sorry, File_Get_Contents MUST be enabled to use this script.
    Im guessing its disabled


  3. #3
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    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.
    Coming and going...
    Highers are getting the better of me

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    <?php

    if(!function_exists("file_get_contents"))
    {

        die(
    "Sorry, BLABLABLA");  

    }

    ?>

  5. #5
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    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 Code:
    <?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
    }
    ?>
    Last edited by lolwut; 14-11-2007 at 07:07 PM.
    i've been here for over 8 years and i don't know why

  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    At above, read above

  7. #7
    Join Date
    Jan 2007
    Location
    England, Uk, World, Universe,
    Posts
    1,012
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Waterfall View Post
    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 Code:
    <?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 thankyews for using mys domain
    wont that show the error if it is enabled?
    my sig ran away,

  8. #8
    Join Date
    Jan 2007
    Location
    Canada eh?
    Posts
    766
    Tokens
    75

    Default

    PHP Code:
    <?php
    if(file_get_contents("http://www.google.com")){
    echo 
    'It works!';
    }else{
    echo 
    'Nope, sorry.';
    }
    ?>

  9. #9
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Ty all

    Il + REP if i can =]
    Coming and going...
    Highers are getting the better of me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •