Escaping # character in Micro Collection

I have developed API using Micro. In routes.php i have used Micro Collection to pass the request to Controllers like:

$collection = new \Phalcon\Mvc\Micro\Collection();
$collection->setHandler('\App\Controllers\V2', true);
$collection->post('/login', 'login');

Controller login function checks if userkey & password is right. I have used

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

to get the requests in login function. If in userkey, i pass # character then all other characters after # are omitted & not received in conroller login function.

Is there anything that i need to do to receive every request data if there is # in there. Any help is appreciated.

edited Sep '17

# hash tag is non-standard HTTP / URI character.

OR: #fragment_id

The #fragment_id is not sent to the server by the client (browser) and will not be added to the full URL.

So your best shot is to simply use POST instead of GET.

edited Sep '17

Sending sensitive info in query (?a=b&c=d) is a bad idea, servers and clients regularly log these, so any unencrypted info there should be considered public, even if the connection is tls enabled (https).

You correctly registered your collection endpoint as POST, so keep using it like that:

$u = $this->request->getPost('userkey');
$p = $this->request->getPost('password');

If your problem is that # is truncated inside the values (values of $u and $p), that's a different problem.