note 75064 added to function.file-exists
| From: | vernon at kesnerdesigns dot net | Date: | Thu, 10 May 2007 15:44:49 +0000 |
| Subject: | note 75064 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126390@lists.php.net to get a copy of this message | ||
In response to seejohnrun's version to check if a URL exists. Even if the file doesn't
exist you're still going to get 404 headers. You can still use get_headers if you don't
have the option of using CURL..
$file = 'http://www.domain.com/somefile.jpg';
$file_headers = @get_headers($file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
$exists = false;
}
else {
$exists = true;
}
----
Server IP: 69.147.83.197
Probable Submitter: 71.168.51.231
----
Manual Page -- http://www.php.net/manual/en/function.file-exists.php
Edit -- https://master.php.net/note/edit/75064
Del: integrated -- https://master.php.net/note/delete/75064/integrated
Del: useless -- https://master.php.net/note/delete/75064/useless
Del: bad code -- https://master.php.net/note/delete/75064/bad+code
Del: spam -- https://master.php.net/note/delete/75064/spam
Del: non-english -- https://master.php.net/note/delete/75064/non-english
Del: in docs -- https://master.php.net/note/delete/75064/in+docs
Del: other reasons-- https://master.php.net/note/delete/75064
Reject -- https://master.php.net/note/reject/75064
Search -- https://master.php.net/manage/user-notes.php