Last active
December 11, 2015 02:19
-
-
Save emmgfx/4530058 to your computer and use it in GitHub Desktop.
Comprobar si archivo remoto existe con PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
function remote_file_exists($file){ | |
$ch = curl_init($file); | |
curl_setopt($ch, CURLOPT_NOBODY, true); | |
curl_exec($ch); | |
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
curl_close($ch); | |
if($retcode==200 || $retcode==302){ | |
return true; | |
}else{ | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment