March 30
2017
Check Remote File
With CURL
function checkRemoteFile($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // Don't download content curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if(curl_exec($ch)!==FALSE) { return true; } else{ return false; } }
Without CURL
function is_webfile($webfile) { $fp = @fopen($webfile, "r"); if ($fp !== false) { fclose($fp); return true; } else { return false; } }