Try this one:
$headers = <<<EOT
Host: www.example.com
Content-Length: 9000
Content-Type: multipart/related;
type="multipart/alternative";
boundary="----_=_NextPart_002_01CF36FC.6259F03C"
X-Http: ok
EOT;
preg_match_all("/(?P<keyname>[a-zA-Z0-9-]+):(?P<value>.*?)[\n\r;]+(?P<sub_value>[\s\S]*?)(?=$|[a-zA-Z0-9-]+:)/", $headers, $match);
You can get the explanation of regex from this link. Just remove the (?:P<...>)
from the regex when you try to get the explanation using the link.