How can I access a GET request in CAKEPHP?

The standard way to do this in Cake is to use $this->params.

$value1 = $this->params['url']['key1'];
$value2 = $this->params['url']['key2'];

According to the CakePHP book, "the most common use of $this->params is to access information that has been handed to the controller via GET or POST operations."

See here.


In CakePHP 2.0 this appears to have changed. According to the documentation you can access $this->request->query or $this->request['url'].

// url is /posts/index?page=1&sort=title
$this->request->query['page'];

// You can also access it via array access
$this->request['url']['page'];

http://book.cakephp.org/2.0/en/controllers/request-response.html