1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Code dont work anymore...

Discussion in 'PHP & Perl' started by nuhll, Aug 11, 2015.

  1. nuhll

    nuhll Junior Member

    Joined:
    Jul 8, 2015
    Messages:
    196
    Likes Received:
    17
    Hi, i used this code since years, without problems, but now it doesnt seem to work anymore.

    I find no errors in error.log...

    Anyone knows whats wrong?

    PHP:
    $url "http://XXX/produkt.php?q=some%20name";if (@file_get_contents($url)): @readfile("$url");else: echo "[div style='float:left'][img title='XXX' src='http://XXX/images/warnung.png'][/div][strong]XXX![/strong] [/br][/br]";endif;
    It should just show a remote website per php, and if not poissble display a warning...
     
  2. RightFootFanatic

    RightFootFanatic Regular Member

    Joined:
    May 31, 2015
    Messages:
    347
    Likes Received:
    192
    Occupation:
    DevOps
    Location:
    Whimsyshire
    I had no problem running your code on my local machine.
    Maybe the site you're requesting just returns an empty page.

    "at-sign" in front of readfile and file_get_contents suppresses the display of error messages.
    For debugging remove the "at" and rerun the script.
    (I'm not allowed to post the at-sign as the forum says as a new user i'm not allowed to submit mail adresses o_O)


    If you switched or update your hosting / php maybe you've also a different php.ini
    So you can try and set error reporting / logging on the script itself by adding right after opening php tag:

    PHP:
    // display errors
    ini_set('error_reporting'E_ALL);
    ini_set('display_errors'1);

    // log errors
    ini_set("log_errors"1);
    ini_set('error_log''/path/to/error.log');
     
  3. nuhll

    nuhll Junior Member

    Joined:
    Jul 8, 2015
    Messages:
    196
    Likes Received:
    17
    Thanks, when i add the code, the site doenst load.. :)
     
  4. nuhll

    nuhll Junior Member

    Joined:
    Jul 8, 2015
    Messages:
    196
    Likes Received:
    17
    I found out, that the code works, thanks for your help.

    Its the PHP Plugin i use for Wordpress. Someone knows easy way to change "[ PHP]" to [INSERT PHP] in all pages/posts? :D


    EDIT:
    i fixed it, i use now "INSERT PHP", changed PHP Code to look for "PHP" instead of "INSERT PHP". WOrks great. Many thanks for yoiur help!
     
    Last edited: Aug 11, 2015