How should I read any header in PHP?
For example the custom header: X-Requested-With.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
IF: you only need a single header, instead of all headers, the quickest method is:
ELSE IF: you run PHP as an Apache module or, as of PHP 5.4, using FastCGI (simple method):
apache_request_headers()
ELSE: In any other case, you can use (userland implementation):
See Also:
getallheaders() – (PHP >= 5.4)
cross platform editionAlias ofapache_request_headers()apache_response_headers() – Fetch all HTTP response headers.headers_list() – Fetch a list of headers to be sent.