Hi Gina,

śr., 3 sty 2024 o 14:41 Gina P. Banyard <intern...@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

Reply via email to