We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How to get requested url with all query strings?

Hello friends, I am developing a web project with phalcon and I am trying to get all url where 404 error page was shown. So everything is working fine. I can get url by $_GET['_url'] to store in database from my error controller. So if some one will visit page '/abc/error/page' it will be stored in database as same, but if '/abc/error/page?hello=true&cyou=later' was requested, i can't store it that way. I get '/abc/error/page' in database. I also tried with php's default $_SERVER['QUERY_STRING'] but it was same. So can anyone help me to store it simple way, the whole url with requested query strings?

Thanx for the help!!!

edited Mar '15

Hi, you can get all querystring through:

For ex:


$this->request->getQuery(); //in your controller,

this return: array(3) { ["_url"]=> string(21) "/provider/status/list" ["julian"]=> string(4) "3232" ["hdhd"]=> string(5) "kskds" }



this return: string(49) "/base/provider/status/list?julian=3232&hdhd=kskds"

look here: https://docs.phalcon.io/es/latest/api/Phalcon_Http_Request.html