We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

bdhamilton on 10/07/08


Tagged

testing


Versions (?)


Who likes this?

5 people have marked this snippet as a favorite

basicmagic
davidsword
duniyadnd
ocool
wilburhimself


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.