diff --git a/lib/Request.php b/lib/Request.php index b794c2c..05a9970 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -125,6 +125,22 @@ return null; } + public static function getHeader($strKey) + { + if (is_array($_SERVER)) + { + $strHeaderKey = "HTTP_{$strKey}"; + $strHeaderKey = strtoupper($strHeaderKey); + $strHeaderKey = preg_replace("/\-/", "_", $strHeaderKey); + + if (array_key_exists($strHeaderKey, $_SERVER)) + if (strlen($_SERVER[$strHeaderKey]) > 0) + return $_SERVER[$strHeaderKey]; + } + + return null; + } + // Returns true if all of the arguments are in the POST request // To be used like: // if (Request::posts("param1", "param2")) {