Re: [RFC] Add http_(get|clear)_last_request_headers() function
| From: | Michał Marcin Brzuchalski | Date: | Wed, 03 Jan 2024 14:38:20 +0000 |
| Subject: | Re: [RFC] Add http_(get|clear)_last_request_headers() function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122099@lists.php.net to get a copy of this message | ||
Hi Gina,
śr., 3 sty 2024 o 14:41 Gina P. Banyard <internals@gpb.moe> napisał(a):
> Hello internals,
>
> I would like to propose an RFC to add the functions
> http_get_last_request_headers() and http_clear_last_request_headers() to
> PHP to replace the magic variable $http_response_header.
>
> Link: https://wiki.php.net/rfc/http-last-response-headers
I was on the specific documentation page describing this feature Today and
was thinking that it is inappropriate as well.
But my thinking was whether it shouldn't be a part of a stream context
instead, something like this:
$response_headers;
$context = stream_context_create([
'http' => ['response_headers' => &$response_headers]
]);
$result = file_get_contents('http://example.com/submit.php', false,
$context);
This way by ref you get a specific HTTP wrapper running under the hood
response headers instead of just the last one.
Any thoughts about that?
Cheers,
Michał Marcin Brzuchalski