note 76427 deleted from function.file-exists by bjori

From: Date: Mon, 16 Jul 2007 19:27:18 +0000
Subject: note 76427 deleted from function.file-exists by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128630@lists.php.net to get a copy of this message
Note Submitter: openspecies ---- /* * EXTERN/LOCAL FILE * a simple alternative without cURL */ function sys_file_exists($f = NULL) { $h = array(); $ret = FALSE; if(!is_null($f)): if(preg_match('/^http|https|ftp/',$f)): $h = @get_headers($f); if(array_key_exists(0,$h)) : $ret = (bool) preg_match('/200|301/',$h[0]); /* HTTP/1.1 301 DAP (directory) */ endif; else: $ret = (file_exists($f) && is_readable($f)); endif; endif; return (($ret == TRUE) ? TRUE : FALSE); } @+

« previous php.notes (#128630) next »