I'm trying to get apikey in header. My problem is when i try to get that key, it gives me different parameter on both live server and local server.
Code :
$apikey = $this->request->getHeaders();
print_r($apikey);
Local Result
Array
(
[Apikey] => *************
)
Live Result :
Array
(
[APIKEY] => *************
)
See the KEY, on local I got Apikey first letter capital, on live APIKEY whole string is capital.
This creates a problem when i tried to access a key from an array.
I had the same issue. Still dont know why it occurs in some servers. So you could do:
$apikey = array_change_key_case(getHeaders(), CASE_LOWER);
This way you will always receive the keys in lowercase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With