how to detect route and get parms from an url?

Hi,

I want to find the route and get params from an url (using the url rules):

ex: I have the url: /admin/articles/index/article_page/2?type=a

The result must be:

array(‘route’ => ‘admin/article/index’, ‘params’=>array(‘article_page’ => 2, ‘type’=>‘a’))

I didn’t find a way to parse the referer url and translate it into yii params.

Any ideas?

Thanks,

Ovidiu

I think you can simply use $_GET array.

I cannot use _GET because I want to “decode” another url (referer url) than the current one (requestUri), and I don’t know all the get params (some of them can be in to url path, other can be in the query string).

I’m looking a way to make reverse engineering for createUrl method.

That’s not possible. The URL parsing mechanism is taylored towards analyzing the current request, not any given URL. It also sets some variables in $_REQUEST, whenever a rule matches - this is surely not what you want. So i think you’re out of luck here.

It’s not good news. It would be useful.

Thanks.

Bump I’m having the exact same problem, maybe look at including this sort of functionality in future?

On a REFERER URL note, you can’t rely on this header being present. Some internet security software will strip this header out of all requests for example.