Title / Description
Code <?php if(!isset($argv[1])) { echo "Usage: ./check_www <url (without http://)>\n"; exit(2); } $url = "http://" . $argv[1]; $header = @get_headers($url, 1); if(!$header) { echo "Could not connect to $url"; exit(2); } if(preg_match('/200/', $header[0])) { print_r($header[0]); exit(0); } elseif(preg_match('/302/', $header[0])) { print_r($header[0]); exit(0); } elseif(preg_match('/301/', $header[0])) { print_r($header[0]); exit(0); } else { print_r($header[0]); exit(2); } ?>
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code