A nice PHP alternative, might need work, but works for me and can be an entry point for someone else. It doesn't do exactly the same as this function, but it rather parses all headers and extracts the HTTP and Content response on it's own array element.
<?php
function http_parse_response($header) {
$retVal = array();
$fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
foreach ($fields as $field) {
if (empty($field)) {
continue;
}
if (preg_match('/([^:]+): (.+)/m', $field, $match)) {
$match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
if( isset($retVal[$match[1]]) ) {
if (!is_array($retVal[$match[1]])) {
$retVal[$match[1]] = array($retVal[$match[1]]);
}
$retVal[$match[1]][] = $match[2];
}
else {
$retVal[$match[1]] = trim($match[2]);
}
}
else {
if (preg_match('/HTTP\//', $field)) {
preg_match('/(.*?) (.*?) (.*)/', $field, $matches);
$retVal['HTTP']['version'] = $matches[1];
$retVal['HTTP']['code'] = $matches[2];
$retVal['HTTP']['reason'] = $matches[3];
}
else {
$retVal['Content'][] = $field;
}
}
}
return $retVal;
}
?>