The HTTP Request provides an object oriented interface to global variables available to our disposal as well as easy access to other useful request information.
We have learned how to make controller and route work, now it's time to see how the application receives HTTP request.
HTTP
The getRequest() method returns all the available object oriented interface to global variables such as $_GET, $_POST, $_FILES, $_COOKIE and $_SERVER.
Request
Now lets explore each ways of accessing the different kind of request data.
GET Data or Query String Data
The getQuery() method returns a parameter collection containing query string data.
The get() method of the parameter collection returns the value of a parameter and null if it doesn't exist.
POST Data
The getPost() method returns a parameter collection containing post data.
The get() method of the parameter collection returns the value of a parameter and null if it doesn't exist.
Cookie Data
The getCookie() method returns a parameter collection containing cookie data.
The get() method of the parameter collection returns the value of a parameter and null if it doesn't exist.
File Data
The getFile() method returns a parameter collection containing file data.
The get() method of the parameter collection returns the value of a parameter and null if it doesn't exist.
Server Data
The getServer() method returns a parameter collection containing server data.
The get() method of the parameter collection returns the value of a parameter and null if it doesn't exist.
Available Parameter Methods
These are the list of available parameter methods that can be use from request.
Method
Description
count()
Return the count of all parameter
add()
Adds a parameter
has()
Returns true if the parameter exists and false if not
get()
Gets a parameter value
remove()
Removes a parameter
all()
Returns all the parameter
getIterator()
Returns an array iterator object
Other Request Data
The isAjax() method returns true if the request was made using AJAX and false if not.
The isSecure() method returns true if the request was made using HTTPS and false if not.
The baseUrl() method returns the base URL of the request.
If you found a typo or error, please help us improve this document.
Contact Us