How do I mimic the route handling? In drupal 7 I have a chunk of code that gets the page content by mimicking what drupal does:

$router_item = menu_get_item($href);
if ($router_item['access']) {
  if ($router_item['include_file']) {
    require_once DRUPAL_ROOT . '/' . $router_item['include_file'];
  }
  $page_callback_result = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
}


$page_callback_result will then hold the HMTL of the content region of that page.

I'm trying to port this to drupal 8 but I'm stuck. Anyone has a clue how to do this?
I'm close, but I'm struggling on getting the controller:

 $request = Request::create('/' . $href);
 $controller_resolver = \Drupal::getContainer()-&gt;get('controller_resolver');
 //$controller = $controller_resolver-&gt;getController($request);
 $callable = $controller_resolver-&gt;getControllerFromDefinition('\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage');
 $arguments = $controller_resolver-&gt;getArguments($request, $callable);
 $page_content = call_user_func_array($callable, $arguments);


The problem is that $controller = $controller_resolver->getController($request); returns FALSE. I'm trying to get the proper controller for a request, for some reason this won't work...
I'm not sure what is the purpose of this, now in Drupal 8 Guzzle is available to creating external and internal request.

$this-&gt;httpClient-&gt;get($href)-&gt;getBody(TRUE);


The httpClient is a service in Drupal 8  api.drupal.org/api/drupal/core%21core.services.yml/service/http_client/8

you need inject this service in your class.

if you need read the Route properties like callback, permissions, etc. you need use the routeProvider service.

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Routing%21RouteProvider.php/class/RouteProvider/8

maybe more information about that problem help us to understand what is the best way to porting for Drupal 8

UPDATE:

Thinking a little more, you want to make a sub-request?

something like https://gist.github.com/dmouse/4976461875a27689d155