So I'm not sure what you are trying to do.
If you are trying to add headers that begin with X from your request to your answer, I would use it in your htaccess file.
Header echo ^X
If you are trying to use the header values ββin a PHP script, then they should be in your $_SERVER , but the names are normalized. for instance
X-Custom-Header: blah X-Na-Bra: true
can be accessed from
<?php // note that headers are prefixed with "HTTP" and "-" and changed to "_" echo $_SERVER['HTTP_X_CUSTOM_HEADER']; echo $_SERVER['HTTP_X_NA_BRA']; // either way you should be able to find them with a print_r($_SERVER); // print_r(getallheaders()); should show the headers without normalized names $tempArray = getallheaders(); echo $tempArray['X-Custom-Header']; ?>
It looks like you want to get values ββfrom the dynamic number of headers that start with X. If so, then your code will not work anyway. Your code (if it works) will always contain the last value of the heading starting with X. So if you have more than 1 heading that starts with X, then you will be missing values. Using your code, you need to create a rule for each header that you want to pass to your PHP script, which sounds like a pain.
If I missed something, then comment below and I will update this answer.
source share