[PHP-NOTES] note 130563 added to reserved.variables.httpresponseheader

[email protected] ("[email protected]") Tue, 02 Dec 2025 14:50:12 +0000
Newsgroups php.notes
Message-ID <[email protected]>
This feature has been deprecated as of PHP 8.5.0.
Here is a way to use it and be compatible with old and modern PHP version:

<?php
function get_contents() {
  file_get_contents("http://example.com");

  // For PHP >= 8.4.0
  if (function_exists('http_get_last_response_headers')) {
    $http_response_header = http_get_last_response_headers();
  }

  // No need for older PHP version
  var_dump($http_response_header);
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2a01:e0a:98c:b410:6473:db76:8c3d:2fcf)
----
Manual Page -- https://php.net/manual/en/reserved.variables.httpresponseheader.php
Edit        -- https://main.php.net/note/edit/130563
Del: integrated  -- https://main.php.net/note/delete/130563/integrated
Del: useless     -- https://main.php.net/note/delete/130563/useless
Del: bad code    -- https://main.php.net/note/delete/130563/bad+code
Del: spam        -- https://main.php.net/note/delete/130563/spam
Del: non-english -- https://main.php.net/note/delete/130563/non-english
Del: in docs     -- https://main.php.net/note/delete/130563/in+docs
Del: other reasons-- https://main.php.net/note/delete/130563
Reject      -- https://main.php.net/note/reject/130563
Search      -- https://main.php.net/manage/user-notes.php