Skip to content

Instantly share code, notes, and snippets.

@flesch
Created August 10, 2010 14:31
Show Gist options
  • Save flesch/517348 to your computer and use it in GitHub Desktop.
Save flesch/517348 to your computer and use it in GitHub Desktop.
Return the HTTP Status code as an integer.
<?php
function get_http_status_header($url) {
preg_match('/[0-9]{3}/', array_shift(get_headers($url)), $matches);
return (int) array_shift($matches);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment