-
-
Save acidtib/eeead3229e872a901855a5eb1dc37e8e to your computer and use it in GitHub Desktop.
PHP: file_exists for remote URL
This file contains hidden or 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 | |
// Source: http://goo.gl/aZ1h8v | |
$file_headers = @get_headers($url); | |
if ($file_headers[0] == 'HTTP/1.0 404 Not Found'){ | |
$file_exists = false; | |
} else { | |
$file_exists = true; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment