Mercurial > SimpleWebPresenter
diff common-functions.inc @ 93:8aadd7a23b68
Moved some functionality from common-functions into Http class.
Reorganized Validator into a class hierarchy.
Added functionality for validating with a buffer in addition to URLs.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 18 Oct 2012 16:44:48 +0200 |
| parents | aafc23919e79 |
| children | 2370f4450983 |
line wrap: on
line diff
--- a/common-functions.inc Thu Oct 18 14:04:19 2012 +0200 +++ b/common-functions.inc Thu Oct 18 16:44:48 2012 +0200 @@ -215,35 +215,6 @@ } /** - * Queries a URL for headers - * - * @param $url the url to query - * @return an associative array of all headers returned - */ -function getHeaders($url, $timeout = 1) -{ - $response = @http_head($url, array("timeout" => $timeout), $info); - - if (array_key_exists('error', $info) && $info['error']) { - throw new RequestException($info); - } - - $headers = array(); - $response = trim($response); - $str = explode("\n", $response); - $headers[''] = trim($str[0]); - foreach($str as $kv) { - $p = strpos($kv, ":"); - if ($p) { - $key = substr($kv, 0, $p); - $value = trim(substr($kv, $p + 1)); - $headers[$key] = $value; - } - } - return $headers; -} - -/** * Generates the query part of an URI * * @param $opts an associative array of options
