ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

File Get Contents Question

October 05, 2009 9:49pm

Subscribe [2]
  • #1 / Oct 05, 2009 9:49pm

    mrwilson1

    34 posts

    Good evening.  I am trying to get out to Stop forum spam to get some files information, is; is my visitor in the forum spam database.  If the answer is yes then I can block them.

    I get the following errors when I use this file.  is there a work around or a setting that i can change to allow this file to do its thing?

    A PHP Error was encountered
    
    Severity: Warning
    
    Message: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration
    
    Filename: main/spambot.php
    
    Line Number: 13
    A PHP Error was encountered
    
    Severity: Warning
    
    Message: file_get_contents(http://www.stopforumspam.com/api?ip=69.138.147.251) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found
    
    Filename: main/spambot.php
    
    Line Number: 13
    
    Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home//public_html/ci/system/application/views/main/spambot.php:14 Stack trace: #0 /home//public_html/ci/system/application/views/main/spambot.php(14): SimpleXMLElement->__construct('') #1 /home//public_html/ci/system/application/views/main/spambot.php(56): checkSpam() #2 /home//public_html/ci/system/application/views/main/header.php(2): include('/home//...') #3 /home//public_html/ci/system/libraries/Loader.php(677): include('/home/shivabe1/...') #4 /home/public_html/ci/system/libraries/Loader.php(307): CI_Loader->_ci_load('69.138.147.251') #5 /home/shivabe1/public_html/ci/system/application/views/template1.php(3): CI_Loader->view(Array) #6 /home//public_html/ci/system/libraries/Loader.php(677): include('/home//...') #7 /home//public_html/ci/system/libraries/Loader.php(307): CI_Loader->_ci_load('main/header') #8 /home//public_html/ci/system in /home//public_html/ci/system/application/views/main/spambot.php on line 14

    I know the file works fine as I use it on other sites.

    Thanks.

  • #2 / Oct 05, 2009 11:55pm

    BrianDHall

    760 posts

    Message: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration

    There is your problem. You are directing file_get_contents to a URL, and URL file-access is an option that PHP can enable or disable in the php.ini file with allow_url_fopen and allow_url_include directives.

    By default these directives cannot be overridden with a call to ini_set(). You will need to either use a function such as CURL to get the file contents and manipulate the file locally, or you need to have your PHP.ini file changed to “allow_url_fopen=1”.

  • #3 / Oct 06, 2009 12:26am

    mrwilson1

    34 posts

    Ok, Understood.

    thank you very much, appreciate it!

  • #4 / Oct 06, 2009 12:21pm

    mrwilson1

    34 posts

    briandhall, thanks again for your expertise, my hosting co. changed it and everything works fine.

  • #5 / Oct 07, 2009 12:15am

    BrianDHall

    760 posts

    briandhall, thanks again for your expertise, my hosting co. changed it and everything works fine.

    You are very welcome, and glad to hear you were able to fix your problem without much fuss.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases