Posted By

bdhamilton on 10/07/08


Tagged

testing


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

basicmagic
davidsword
duniyadnd
ocool
wilburhimself
troynt
irishsk
nb109
vali29
sultano
tewoos
Some0ne


Test whether URL exists


 / Published in: PHP
 

URL: http://us2.php.net/manual/en/function.file-exists.php#84918

  1. function url_exists($url) {
  2. $hdrs = @get_headers($url);
  3. return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false;
  4. }

Report this snippet  

You need to login to post a comment.