unidox Posted May 27, 2008 Share Posted May 27, 2008 I have this script: $url = "http://www.site.com/license.php?key=" . SITE_LIC . "&ref=" . $_SERVER["SERVER_NAME"] . ""; $lic = @fopen($url, "r+"); $lic = @fread($lic, 8192); if ($lic == "0") { header("Location: http://www.site.com/index.php?p=lic_invalid&site=" . $_SERVER["SERVER_NAME"] . ""); exit(); } fclose($lic); If I type the url in my address bar, it outputs 1 as desired. But when I try to echo $lic, nothing even outputs. Whats wrong? Link to comment https://forums.phpfreaks.com/topic/107387-solved-fread/ Share on other sites More sharing options...
haku Posted May 27, 2008 Share Posted May 27, 2008 You are having some errors somewhere. Take away the '@' sign, as this suppresses errors and just skips over them. This may tell you what your problem is. Using the '@' sign is almost always sloppy programming, and should only ever be used a very small number of situations. Link to comment https://forums.phpfreaks.com/topic/107387-solved-fread/#findComment-550540 Share on other sites More sharing options...
The Little Guy Posted May 27, 2008 Share Posted May 27, 2008 I don't know of any situation where it is needed, that is what if/else is for. Link to comment https://forums.phpfreaks.com/topic/107387-solved-fread/#findComment-550549 Share on other sites More sharing options...
haku Posted May 27, 2008 Share Posted May 27, 2008 I found one when working with gd image functions a while back. I can't remember the exact details, but it returned an error when nothing was found, instead of a -1 or something that I could have used. In that one situation it was preferable to use the '@' symbol, but I have never found any other situations. Link to comment https://forums.phpfreaks.com/topic/107387-solved-fread/#findComment-550607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.