implements Phalcon\Http\RequestInterface, Phalcon\DI\InjectionAwareInterface
Encapsulates request information for easy and secure access from application controllers. The request object is a simple value object that is passed between the dispatcher and controller classes. It packages the HTTP request environment.
$request = new Phalcon\Http\Request(); if ($request->isPost() == true) { if ($request->isAjax() == true) { echo 'Request was made using POST and AJAX'; } }
Sets the dependency injector
Returns the internal dependency injector
Gets a variable from the $_REQUEST superglobal applying filters if needed. If no parameters are given the $_REQUEST superglobal is returned
//Returns value from $_REQUEST["user_email"] without sanitizing $userEmail = $request->get("user_email"); //Returns value from $_REQUEST["user_email"] with sanitizing $userEmail = $request->get("user_email", "email");
Gets a variable from the $_POST superglobal applying filters if needed If no parameters are given the $_POST superglobal is returned
//Returns value from $_POST["user_email"] without sanitizing $userEmail = $request->getPost("user_email"); //Returns value from $_POST["user_email"] with sanitizing $userEmail = $request->getPost("user_email", "email");
Gets a variable from put request
$userEmail = $request->getPut("user_email"); $userEmail = $request->getPut("user_email", "email");
Gets variable from $_GET superglobal applying filters if needed If no parameters are given the $_GET superglobal is returned
//Returns value from $_GET["id"] without sanitizing $id = $request->getQuery("id"); //Returns value from $_GET["id"] with sanitizing $id = $request->getQuery("id", "int"); //Returns value from $_GET["id"] with a default value $id = $request->getQuery("id", null, 150);
Gets variable from $_SERVER superglobal
Checks whether $_REQUEST superglobal has certain index
Checks whether $_POST superglobal has certain index
Checks whether put has certain index
Checks whether $_GET superglobal has certain index
Checks whether $_SERVER superglobal has certain index
Gets HTTP header from request data
Gets HTTP schema (http/https)
Checks whether request has been made using ajax. Checks if $_SERVER[‘HTTP_X_REQUESTED_WITH’]==’XMLHttpRequest’
Checks whether request has been made using SOAP
Checks whether request has been made using any secure layer
Gets HTTP raw request body
Gets decoded JSON HTTP raw request body
Gets active server address IP
Gets active server name
Gets information about schema, host and port used by the request
Gets most possible client IPv4 Address. This method search in $_SERVER[‘REMOTE_ADDR’] and optionally in $_SERVER[‘HTTP_X_FORWARDED_FOR’]
Gets HTTP method which request has been made
Gets HTTP URI which request has been made
Gets HTTP user agent used to made the request
Check if HTTP method match any of the passed methods
Checks whether HTTP method is POST. if $_SERVER[‘REQUEST_METHOD’]==’POST’
Checks whether HTTP method is GET. if $_SERVER[‘REQUEST_METHOD’]==’GET’
Checks whether HTTP method is PUT. if $_SERVER[‘REQUEST_METHOD’]==’PUT’
Checks whether HTTP method is PATCH. if $_SERVER[‘REQUEST_METHOD’]==’PATCH’
Checks whether HTTP method is HEAD. if $_SERVER[‘REQUEST_METHOD’]==’HEAD’
Checks whether HTTP method is DELETE. if $_SERVER[‘REQUEST_METHOD’]==’DELETE’
Checks whether HTTP method is OPTIONS. if $_SERVER[‘REQUEST_METHOD’]==’OPTIONS’
Checks whether request includes attached files
Gets attached files as Phalcon\Http\Request\File instances
Returns the available headers in the request
Gets web page that refers active request. ie: http://www.google.com
Process a request header and return an array of values with their qualities
Process a request header and return the one with best quality
Gets array with mime/types and their quality accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT’]
Gets best mime/type accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT’]
Gets charsets array and their quality accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT_CHARSET’]
Gets best charset accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT_CHARSET’]
Gets languages array and their quality accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT_LANGUAGE’]
Gets best language accepted by the browser/client from $_SERVER[‘HTTP_ACCEPT_LANGUAGE’]
Gets auth info accepted by the browser/client from $_SERVER[‘PHP_AUTH_USER’]
Gets auth info accepted by the browser/client from $_SERVER[‘PHP_AUTH_DIGEST’]
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Http_Request.html