public function EasyRdf_Http_Response::getHeadersAsString

Get all headers as string

Parameters

boolean $statusLine Whether to return the first status line (ie "HTTP 200 OK"):

string $br Line breaks (eg. "\n", "\r\n", "<br />"):

Return value

string

1 call to EasyRdf_Http_Response::getHeadersAsString()
EasyRdf_Http_Response::asString in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Http/Response.php
Get the entire response as string

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Http/Response.php, line 239

Class

EasyRdf_Http_Response
Class that represents an HTTP 1.0 / 1.1 response message.

Code

public function getHeadersAsString($statusLine = true, $br = "\n") {
  $str = '';
  if ($statusLine) {
    $str = "HTTP/{$this->version} {$this->status} {$this->message}{$br}";
  }

  // Iterate over the headers and stringify them
  foreach ($this->headers as $name => $value) {
    if (is_string($value)) {
      $str .= "{$name}: {$value}{$br}";
    }
    elseif (is_array($value)) {
      foreach ($value as $subval) {
        $str .= "{$name}: {$subval}{$br}";
      }
    }
  }
  return $str;
}