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

         require 'aagateway.php';
         $r = new aaGateway();

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

          if($sl==0) break;

         echo $r->get_response();


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