Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 991851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:10:28+00:00 2026-05-16T06:10:28+00:00

I am trying to get the routing information from a random URL (part of

  • 0

I am trying to get the routing information from a random URL (part of my application).

I tried to instantiate a Zend_Controller_Request_Http with an URL but it didn’t fill in the controller, module, action fields automatically.

I suppose it should somehow be linked to the Route info but cannot figure how to connect this.

Any leads?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:10:28+00:00Added an answer on May 16, 2026 at 6:10 am

    Its not directly linked. What happens is the router calls its route method passing the request as its argument. It then loops through all the registered routes in reverse order calling the route’s match method with the request as an argument – if it matches it sets the parameters on the request before its returned.

    The problem is you cant directly call Zend_Controller_Router_Rewrite::route without modifying the current request cycle, so you have to rely on some “fudgery” or reproduce the logic in this method in your own ruter sbuclass or elsehwere.

    Example of fudging:

    // assume $router is your router instance, $request is the REAL request.
    
    $testRequest = new Zend_Controller_Request_Http($url);
    
    // need to use a try because if the route doesnt match youve got an exception coming
    try {
      $router->route($testRequest);
    } catch(Zend_Controller_Router_Exception $e) {
      $testRequest = false;
    }
    
    // revert back to the real current route which was modified during the previous call
    
    $router->route($request);
    
    if(false !== $testRequest) {
      // consume what you need form testRequest as you normally would
      print_r($testRequest->getParams());
    }
    

    I ran into problems with this down the line after i started getting into more complex request lifecyles. I dont remember why but i do remember my solution was to sub class the router and ad a method that route that looked something like this:

    public function parseRoute(Zend_Controller_Request_Abstract $request)
    {
    
       $preservedRoute = $this->_currentRoute;
       try {
    
          $router->route($request);
          $this->_currentRoute = $preservedRoute;
    
       } catch(Zend_Controller_Router_Exception $e) {
    
          $this->_currentRoute = $preservedRoute;
          return false;
       }
    
       return $request;
    }
    

    Also keep in mind this is all from memory and it was with 1.6 or 1.7 not the current version so YMMV. Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get to grips with Cake's routing, but I'm having no luck
I am trying to create url routing with strongly typed objects for pages but
I'm trying to add URL routing to a web application running in Tomcat 5.5.
I'm trying to take advantage of the default routing so I get a URL
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
To be specific, I'm trying to get ActionController::Routing::Routes.recognize_path to recognize a route that is
I'm stuck on a routing problem within a Rails 3.0.x application. What I'm trying
I'm trying to get some custom routing going on in Magento using the following
I am trying to get a PHP URI routing system to work. I am
trying to get rails routing to click and just not getting it have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.