PHP: Does $_SERVER['HTTP_X_REQUESTED_WITH'] exist or not?
- by Hank
All over the Internet, included even here at StackOverlow, people state that a good way to check if a request is AJAX or not is to do the following:
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
However, I don't see $_SERVER['HTTP_X_REQUESTED_WITH'] in the official PHP documentation
And when I try to do the following:
echo $_SERVER['HTTP_X_REQUESTED_WITH'];
Nothing is outputted.
Am I doing something wrong? Because I'd really like to be able to use $_SERVER['HTTP_X_REQUESTED_WITH'] if it's available.