Last active
April 24, 2017 08:19
-
-
Save Bujhm/f2b409d2dcab190252aadb863bfaf880 to your computer and use it in GitHub Desktop.
GetLastHeaderStatus got from php.net and simply wrapped in a function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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