Skip to content

Instantly share code, notes, and snippets.

@Bujhm
Last active April 24, 2017 08:19
Show Gist options
  • Select an option

  • Save Bujhm/f2b409d2dcab190252aadb863bfaf880 to your computer and use it in GitHub Desktop.

Select an option

Save Bujhm/f2b409d2dcab190252aadb863bfaf880 to your computer and use it in GitHub Desktop.
GetLastHeaderStatus got from php.net and simply wrapped in a function
<?php
/**
* Get Last Header (no need to follow by redirect manually)
* @param $url
* @return array
*/
function getLastHeaderStatus($url)
{
$result = array();
$header = get_headers( $url, 1 );
foreach ( $header as $key => $value ) {
if ( is_array( $value ) ) {
$value = end( $value );
}
$result[$key] = $value;
}
return $result;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment