Hi, I'm facing this scenario: 1. User inputs URL 2. I have to check and return if URL exists How to do that? I came up with this error_reporting(0); if (file_get_contents($file)) return 'file exists' else return 'file doesnt exist' ; Code (markup): Since file_get_contents, much like fopen and other file functions throws a warning if file doesn't exist I had to put error_reporting(0) Code (markup): if front of it. Does anyone know of a better way to disable warning on file_get_contents? BR Gregor
$url = 'http://www.allaboutturkey.com'; $handle = @fopen($url,'r'); if($handle !== false){ echo 'Exists'; } else{ echo "Doesn't"; } PHP: