Why are not all headers returning?

I made a request to a micro application with a apecific Token header. But $di->get('request')->getHeader('token') returns empty and getallheaders() return all headers and my token header. Why?



81.2k

Check that the header has the same case (uppercase, lowercase) than the one that appears in getallheaders()

I tried getallheaders() but didnt worked out. Any idea? Make no difference to get value from getallheaders() but I wanted to get value from request... =/



5.5k

if your header name X-API-KEY

you can header using this code below

$this->request->getHeader("HTTP_X_API_KEY");

nb : getallheader() wont work in my system

Prasetyo getallheader() is apache-only function.

if your header name X-API-KEY

you can header using this code below

$this->request->getHeader("HTTP_X_API_KEY");

nb : getallheader() wont work in my system