I misread your first post, thinking you wanted to retrieve the headers only, but I see you were asking how to extract them from the response.
You can explode the response at the header/content boundary:
PHP Code:
list($header, $body) = explode("\r\n\r\n", $response, 2);
Or you can use curl_getinfo():
PHP Code:
// ...[curl code]...
$info = curl_getinfo($ch);
curl_close($ch);
$header = substr($response, 0, $info['header_size']);
$body = substr($response, -$info['download_content_length']);
Edit: Then to get the status line:
PHP Code:
$status = strtok($header, "\r\n");
Bookmarks