public static function parseHeaders($headerString)
	{
		$headers = explode("\n", $headerString);
		$keys = array_keys($headers);
		$regexReturnCode = '/^\S+\s+(\d+)\s?(.*)/';
		$regexHeader = '/^(.*?):\s*(.*)$/';
		$headers['Return-Code'] = preg_match($regexReturnCode, $headerString, $matches)
			? $matches[1]
			: 200;
		foreach ($keys as $k) {
			$v = trim($headers[$k]);
			unset($headers[$k]);
			if (preg_match($regexHeader, $v, $matches)) {
				$k = $matches[1];
				$k = preg_replace_callback('/(^|-)(.?)/', function ($matches) {
					return $matches[1].strtoupper($matches[2]);
				}, $k);
				$v = trim($matches[2]);
				if (isset($headers[$k])) {
					if (!is_array($headers[$k])) {
						$headers[$k] = array($headers[$k]);
					}
					$headers[$k][] = $v;
				} else {
					$headers[$k] = $v;
				}
			} elseif (preg_match($regexReturnCode, $v, $matches)) {
				$headers['Return-Code'] = $matches[1];
			}
		}
		return $headers;
	}