code: private function parseHttpHeader($header)
      {
          $parsedHeader = array();
          foreach (explode("\n", $header) as $line) {
              $splitLine = preg_split('/:\s/', $line, 2, PREG_SPLIT_NO_EMPTY);
  
              if (sizeof($splitLine) == 2) {
                  $k = strtolower(trim($splitLine[0]));
                  $v = trim($splitLine[1]);
                  if (array_key_exists($k, $parsedHeader)) {
                      $parsedHeader[$k] = $parsedHeader[$k] . "," . $v;
                  } else {
                      $parsedHeader[$k] = $v;
                  }
              }
          }
  
          return $parsedHeader;
      }
docs: Build an associative array of an HTTP Header lines. For requests, the HTTP request line
  is not contained in the array, nor is the HTTP status line for response headers.
  
  @param $header
  @return array