PHP Zend Framework - How to Get Request URI Fragment from Request Object?
php, request, uri, zend-framework
Solution
The fragment part of the URL is never sent to the server via GET requests (or any kind of HTTP request for that matter), the only way you can get it is if you write a Javascript snippet that parses the URL and sends the fragment back to the server via Ajax for instance.
This can't be done with PHP alone.
Problem
Say e.g. i have a URI `http://127.0.0.1/somecontroller/someaction#12345` that takes me to the `someAction()` action of the someController controller. From there, i am able to retrieve the Request object via `$this->getRequest()`. i am also able to retrieve various information regarding the URI from the Request object. But, how can i retrieve the fragment (i.e. the "12345" part after the # in the e.g.)? Neither `getRequestUri()` nor `getParams()` turn up the fragment part. Thanks!