Ejemplo n.º 1
0
 public static function sendResponse(Response $response)
 {
     $statusCode = $response->getStatusCode();
     $reasonPhrase = $response->getReasonPhrase();
     $protocolVersion = $response->getProtocolVersion();
     echo "HTTP/{$protocolVersion} {$statusCode} {$reasonPhrase}" . PHP_EOL;
     foreach ($response->getHeaders() as $headerName => $headerValues) {
         echo $headerName . ": " . implode(", ", $headerValues) . PHP_EOL;
     }
     echo (string) $response->getBody();
 }
Ejemplo n.º 2
0
 public static function sendResponse(Response $response)
 {
     $statusCode = $response->getStatusCode();
     $reasonPhrase = $response->getReasonPhrase();
     $protocolVersion = $response->getProtocolVersion();
     $GLOBALS["http_response_code"] = $statusCode;
     header("HTTP/{$protocolVersion} {$statusCode} {$reasonPhrase}");
     foreach ($response->getHeaders() as $headerName => $headerValues) {
         header($headerName . ": " . implode(", ", $headerValues));
     }
     echo (string) $response->getBody();
 }