We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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?



98.9k

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... =/



7.9k

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