Mercurial > SimpleWebPresenter
comparison common-functions.inc @ 73:947d53f95ccd
Refactor Sitemap into a separate class.
Catch all exceptions in index.php and send a 500 error if nothing else
catches it.
Check response status before submitting to sitemap.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Fri, 12 Oct 2012 01:06:32 +0200 |
| parents | dd4ddedca4c5 |
| children | ff5fc61aa5ea |
comparison
equal
deleted
inserted
replaced
| 72:7bc88fe62101 | 73:947d53f95ccd |
|---|---|
| 196 */ | 196 */ |
| 197 function getHeaders($url) | 197 function getHeaders($url) |
| 198 { | 198 { |
| 199 $response = http_head($url, array("timeout" => 1), $info); | 199 $response = http_head($url, array("timeout" => 1), $info); |
| 200 $headers = array(); | 200 $headers = array(); |
| 201 $response = trim($response); | |
| 201 $str = explode("\n", $response); | 202 $str = explode("\n", $response); |
| 203 $headers[''] = trim($str[0]); | |
| 202 foreach($str as $kv) { | 204 foreach($str as $kv) { |
| 203 $p = strpos($kv, ":"); | 205 $p = strpos($kv, ":"); |
| 204 if ($p) { | 206 if ($p) { |
| 205 $key = substr($kv, 0, $p); | 207 $key = substr($kv, 0, $p); |
| 206 $value = trim(substr($kv, $p + 1)); | 208 $value = trim(substr($kv, $p + 1)); |
