note 84918 modified in function.file-exists by danbrown
| From: | danbrown@php.net | Date: | Wed, 06 Aug 2008 00:45:02 +0000 |
| Subject: | note 84918 modified in function.file-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143193@lists.php.net to get a copy of this message | ||
Here is a simpler version of url_exists:
<?php
function url_exists($url) {
$hdrs = @get_headers($url);
return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) :
false;
}
?>
--was--
Here is a simpler version of url_exists:
function url_exists($url) {
$hdrs = @get_headers($url);
return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) :
false;
}
http://php.net/manual/en/function.file-exists.php