Search code examples
phplocalhostweb-hostingsimple-html-dom

PHP file not working properly on web hosting site


When I run my website on localhost everything works fine, but when I host with atspace.com, simple_html_dom.php doesn't work properly. I can give the code if you need it but does anyone know what the problem may be. Also atspace.com has PHP enabled so I am pretty sure it's not that.

localhost https://i.sstatic.net/xjJvA.png

atspace.com https://i.sstatic.net/fXkaR.png

EDIT: Turns out as I was on a free hosting plan, they didn't allow outgoing http connections or something but hostinger allows it so I am just hosting with them instead now


Solution

  • file_get_contents() may have been disabled in your web hosts PHP config. You need to contact your host. Can your provide a link to a page on the server that contains only the following:

    <?php
    phpinfo();
    ?>
    

    This will help to confirm it's been disabled.

    EDIT: Just ran the following and it worked. Are you using the function like this?

    <?php
    $test = file_get_contents("http://www.blade-edge.com/images/KSA/Flights/craft.asp?r=true&db=dunai");
    echo $test;