title: Zend Dispatch - return variables from controller->action
body: <p>I have a little issue with Zend. I am trying to make some fake HTTP requests and after the <code>module-&gt;controller-&gt;action</code> is executed, to return random variables that are set in that action. Like in the case of variables set with <code>view-&gt;assign(,)</code> - I can access them later from view file (.phtml).</p>
  
  <p>Here is part of my code:</p>
  
  <p><code>/application/controller/IndexController.php</code></p>
  
  <pre><code>&lt;?php
  class IndexController extends Zend_Controller_Action
  {
      public function init(){}
      public function indexAction()
      {
          #$this-&gt;view seems to be a NULL value from the fake request, so I can't pass variables to it 
          //$this-&gt;view-&gt;x = 'y';
          echo 'test';
          return array(
              'x' =&gt; 'y'
          );
      }
  }
  </code></pre>
  
  <p><code>/public/index2.php</code></p>
  
  <pre><code>&lt;?php
  //--cut--
  $application-&gt;bootstrap();
  $options = array(
      'action' =&gt; 'index',
      'controller' =&gt; 'index',
      'module' =&gt; 'default'
  );
  if( isset($options['action'], $options['module'], $options['controller']) )
  {
  
      $request = new Zend_Controller_Request_Http ();
      $request-&gt;setModuleName($options['module'])-&gt;setActionName($options['action'])-&gt;setControllerName($options['controller']);  
      $frontController = Zend_Controller_Front::getInstance ()-&gt;returnResponse ( true );
  
      $response = new Zend_Controller_Response_Http ();
  
      $frontController-&gt;getDispatcher ()-&gt;dispatch ( $request, $response );
      echo '$response:&lt;b&gt;Zend_Controller_Response_Http&lt;/b&gt;&lt;br&gt;';
      //This returns me the body of what I echo in the indexAction but not the variables.
      var_dump($response);
  }
  </code></pre>
  
  <p>Thank you so much!</p>