Code dont work anymore...

nuhll

Junior Member
Joined
Jul 8, 2015
Messages
193
Reaction score
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...
 
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');
 
Thanks, when i add the code, the site doenst load.. :)
 
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:
Back
Top