You are here

function cc::http_parse_headers in Constant Contact 6.2

* Parses the response headers and response code into a readable format * *

Parameters

array An associative array of headers to include in the HTTP request: * * @access private

1 call to cc::http_parse_headers()
cc::http_parse_response in ./class.cc.php
* This method parses the raw http response into local variables we use later on * * * @access private

File

./class.cc.php, line 1951

Class

cc
@file

Code

function http_parse_headers($headers) {
  $replace = $this->http_linebreak == "\n" ? "\r\n" : "\n";
  $headers = str_replace($replace, $this->http_linebreak, trim($headers));
  $headers = explode($this->http_linebreak, $headers);
  $this->http_response_headers = array();
  if (preg_match('/^HTTP\\/\\d\\.\\d (\\d{3})/', $headers[0], $matches)) {
    $this->http_response_code = intval($matches[1]);
    array_shift($headers);
  }
  if ($headers) {
    foreach ($headers as $string) {
      list($header, $value) = explode(': ', $string, 2);
      $this->http_response_headers[$header] = $value;
    }
  }
}