file_get_contents() question

Discussion in 'PHP' started by afridy, Nov 23, 2010.

  1. #1
    Hai folks,

    i am in urgent need of using file_get_contents() function in my php scrip.
    but my hosting has disabled it. i am using 1and1 shared hosting.

    i want allow_url_fopen = On

    How to do it :confused:
     
    afridy, Nov 23, 2010 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    Try

    $file = fopen($file,'r');
    while($cont = fread($file,1024536)){
    $file_content .= $cont;
    }
    fclose($file);
    PHP:
    Although that may also be blocked.

    Or if it's url based try:

    exec('wget $url');
    PHP:
     
    mfscripts, Nov 23, 2010 IP
  3. afridy

    afridy Well-Known Member

    Messages:
    810
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Thanks folks,

    Good news is 1and1 allows global php configuration overide.
    i just created a php.ini file using note pad and put the following content. Placed it on the directory where my scrip resides and it workd!

    allow_url_fopen = on;
     
    afridy, Nov 23, 2010 IP
  4. afridy

    afridy Well-Known Member

    Messages:
    810
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Thanks MFScripts for the comment. any way my problem already solved while a go :)
     
    afridy, Nov 23, 2010 IP