I'm using Zend Framework 2, this is my code:
$prevsingletrackurl = $this->getRequest()->getHeader('Referer')->getUri();
From this code which is defined in a controller's method I'm getting previous URL, now what I need to know some information of this from this, it contains which route, controller, method for my own requirement.
You can use the route stack itself to try to match it. It will return you a RouteMatch if the request object matched:
You can access the route stack ("router") from the service locator; in the root service locator, it is registered as 'Router'. You can inject the route stack in your factory. For instance in a Controller:
Use it in your controller as this:
This code i have used inside a controller action method
$request = $this->getRequest(); $getHeaderReferer=$request->getHeader('Referer');