.. _the-predefined-locally-scoped-\$http_response_header-variable-is-deprecated,:
The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead
-------------------------------------------------------------------------------------------------------------------------
.. meta::
:description:
The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead: The PHP variable ``$http_response_header`` is automagically created after a call to a remote resource.
:og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png
:og:type: article
:og:title: The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead
:og:description: The PHP variable ``$http_response_header`` is automagically created after a call to a remote resource
:og:url: https://php-errors.readthedocs.io/en/latest/messages/the-predefined-locally-scoped-%24http_response_header-variable-is-deprecated%2C.html
:og:locale: en
:twitter:card: summary_large_image
:twitter:site: @exakat
:twitter:title: The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead
:twitter:description: The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead: The PHP variable ``$http_response_header`` is automagically created after a call to a remote resource
:twitter:creator: @exakat
:twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png
.. raw:: html
Description
___________
The PHP variable ``$http_response_header`` is automagically created after a call to a remote resource. It contains the returned headers, for further analysis. This variable is deprecated since PHP 8.5, and will disappear in PHP 9.0. It should be replaced with a call to http_get_last_response_headers().
Example
_______
.. code-block:: php
Solutions
_________
+ Call ``http_get_last_response_headers()`` instead of relying on the variable.
Changed Behavior
________________
This error may appear following an evolution in behavior, in previous versions. See `http_response_header `_.
Static Analysis
_______________
This error may be tracked down with the following static analysis rules: `Php/HttpResponseHeaderIsDeprecated `_.