
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
PHP $http_response_header
Introduction
The superglobal $http_response_header array is populated by HTTP response headers as is the case with get_headers() functions. This array is created in local space of PHP
$http_response_header
Example
<?php file_get_contents("http://localhost"); $arr=$http_response_header; foreach ($arr as $key=>$val) echo "<p>$key=>$val </p>"; ?>
Output
Browser will display result similar to following
0=>HTTP/1.1 302 Found 1=>Date: Tue, 08 Sep 2020 14:49:24 GMT 2=>Server: Apache/2.4.41 (Win64) OpenSSL/1.0.2s PHP/7.1.32 3=>X-Powered-By: PHP/7.1.32 4=>Location: http://localhost/dashboard/ 5=>Content-Length: 0 6=>Connection: close 7=>Content-Type: text/html; charset=UTF-8 8=>HTTP/1.1 200 OK 9=>Date: Tue, 08 Sep 2020 14:49:24 GMT 10=>Server: Apache/2.4.41 (Win64) OpenSSL/1.0.2s PHP/7.1.32 11=>Last-Modified: Mon, 02 Sep 2019 15:45:31 GMT 12=>ETag: "1d99-59193dc9c3cc0" 13=>Accept-Ranges: bytes 14=>Content-Length: 7577 15=>Connection: close 16=>Content-Type: text/html
- Related Articles
- PHP php://
- Upload file with php to another php server
- PHP Generators.
- PHP Overloading
- PHP Traits
- PHP $_GET
- PHP $GLOBALS
- PHP $_SERVER
- PHP superglobals
- PHP References
- PHP Constants
- PHP Expressions
- PHP Tags
- PHP Iterables
- PHP NULL

Advertisements