I am attempting to relay http traffic from apache to custom made applications running on different ports ( something similar to fast cgi ) , but much more simplified.

around the application side i've got a http server.

around the apache side i've this

         <?php
         require 'aagateway.php';
         $r = new aaGateway();
         $r->connect();

         $r->send("GET ".$_SERVER[REQUEST_URI]." HTTP/1.11\n"); 
         foreach (getallheaders() as $name => $value) { $r->send("$name: $value\n"); }
         $r->send("\n");

         while(1)
          {
          $t=$r->get_response();
          $sl=strlen($t);
          if($sl==0) break;
          header($t);
          }

         echo $r->get_response();

         return;
         ?>

the request and connected headers are received through the application properly.

My issue is, how do you then obtain the response headers in the application and pass these to apache. (the issue is within the header($t) It is not setting the headers