Request


Description


The task of the request class is to route requests to the appropriate controller action and to provide information about the current request.


Subrequests


You can request a controller action within another controller action using subrequests.


$response = Request::factory('controller/action')->execute();

Methods


controller()


The controller method returns the name of the requested controller.


$controllerName = $this->request->controller();

action()


The action method returns the name of the requested controller.


$actionName = $this->request->action();

ip()


The ip method returns the ip address of the client who made the request.


$ip = $this->request->ip();

referer([$default = ''])


The referer method returns the URL of the referer.


$referer = $this->request->referer();

route()


The route method returns the route of the main request.


$route = $this->request->route();

method()


The method method returns the request method that was used to access the page.


if($this->request->method() == 'POST')
{
	// Do something
}

isAjax()


The isAjax method returns TRUE if the page was requested using AJAX and FALSE it not.


if($this->request->isAjax())
{
	// Do something
}

isSecure()


The isSecure method returns TRUE if the page was requested using HTTPS and FALSE it not.


if($this->request->isSecure())
{
	// Do something
}

isMain()


The isMain method returns TRUE this is is the main request and FALSE if its a subrequest.


if($this->request->isMain())
{
	// Do something
}