. */ namespace Volkszaehler\View\HTTP; /** * HTTP request * * also used for data * * @author Steffen Vogel * @package http */ class Request { protected $headers; protected $parameters; /** * HTTP request methods * * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html */ protected $method; /** * constructor */ public function __construct() { $this->headers = apache_response_headers(); // NOTICE only works for Apache Webservers $this->method = $_SERVER['REQUEST_METHOD']; $this->parameters= array( 'get' => $_GET, 'post' => $_POST, 'cookies' => $_COOKIE, 'files' => $_FILES ); unset($_GET, $_POST, $_COOKIE, $_FILES); } /** * setter & getter */ public function getHeader($header) { return $this->headers[$header]; } public function getMethod() { return $this->method; } public function getParameter($name, $method = 'get') { return (isset($this->parameters[$method][$name])) ? $this->parameters[$method][$name] : NULL; } public function getParameters($method = 'get') { return $this->parameters[$method]; } } ?>