Phalcon Request Environment

HTTP request is originated by browser which contains additional information regarding the request such as header data, files, variables, etc. A web based application needs to parse that information so as to provide the correct response back to the requester. All the information of request is stored under directory Phalcon\Http\Request.

Retrieving Values

To retrieve value PHP automatically decides the array type as $_GET and $_POST depending on type of request.

Phalcon\Http\Request allows us to access the values stored in the $_REQUEST, $_GET and $_POST arrays and filter them with the filter service i.e. Phalcon\Filter.

Following is the example of same behavior:

Output

Phalcon Request 1

Methods for Request

MethodsDescription
public setDI (Phalcon\DiInterface $dependencyInjector)Sets the dependency injector.
public getDI ()Returns the internal dependency injector.
public getServer (mixed $name)Gets variable from $_SERVER superglobal.
public has (mixed $name)Checks whether $_REQUEST superglobal has certain index.
public hasPost (mixed $name)Checks whether $_POST superglobal has certain index.
public hasPut (mixed $name)Checks whether the PUT data has certain index.
public hasQuery (mixed $name)Checks whether $_GET superglobal has certain index.
final public hasServer (mixed $name)Checks whether $_SERVER superglobal has certain index.
final public getHeader (mixed $header)Gets HTTP header from request data.
public getScheme ()Gets HTTP schema (http/https).
public isAjax ()Checks whether request has been made using ajax.
public isSoap ()Checks whether request has been made using SOAP.
public isSecure ()Checks whether request has been made using any secure layer.
public getRawBody ()Gets HTTP raw request body.
public getServerAddress ()Gets active server address IP.





Latest Courses