note 130270 added to function.getallheaders
| From: | hans@loltek.net | Date: | Mon, 28 Apr 2025 13:39:11 +0000 |
| Subject: | note 130270 added to function.getallheaders | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222113@lists.php.net to get a copy of this message | ||
if you want a specific header,
<?php
function get_response_header(string $header_name = 'Content-Type', bool $trim = true):
?string
{
$header_name .= ':';
$list = headers_list();
$len = strlen($header_name);
foreach ($list as $header) {
if (strncasecmp($header, $header_name, $len) === 0) {
$ret = substr($header, $len);
if ($trim) {
$ret = trim($ret);
}
return $ret;
}
}
return null;
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 62.101.231.203)
----
Manual Page -- https://php.net/manual/en/function.getallheaders.php
Edit -- https://main.php.net/note/edit/130270
Del: integrated -- https://main.php.net/note/delete/130270/integrated
Del: useless -- https://main.php.net/note/delete/130270/useless
Del: bad code -- https://main.php.net/note/delete/130270/bad+code
Del: spam -- https://main.php.net/note/delete/130270/spam
Del: non-english -- https://main.php.net/note/delete/130270/non-english
Del: in docs -- https://main.php.net/note/delete/130270/in+docs
Del: other reasons-- https://main.php.net/note/delete/130270
Reject -- https://main.php.net/note/reject/130270
Search -- https://main.php.net/manage/user-notes.php