note 73610 deleted from function.curl-setopt by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:28:07 +0000 |
| Subject: | note 73610 deleted from function.curl-setopt by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154985@lists.php.net to get a copy of this message | ||
Note Submitter: Killerwhile
----
In response to "brett at brettbrewer dot com" and Jamolkhon, the fact you don't take
into account is when a redirection (Location: ...) occurs, all the headers are given so the \r\n\r\n
can also separate twp consecutive headers.
An even better trick to get the header is to use CURLINFO_HEADER_SIZE :
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$headers = substr($output, 0, $header_size - 4);
$body = substr($output, $header_size);
Then $headers contains all the headers.