Emerson Maningo
Emerson Maningo

Reputation: 2259

PHP: Retrieving the HTTP response headers that comes along with the $_POST

Here is my situation. I have a PHP script in my own server. The purpose is to receive $_POST values from another server. Retrieving these $_POST values are simple. But the remote server includes an additional HTTP header with the sent $_POST request that my server needs to retrieve.

The question is how I can grab this HTTP header? The flow goes like this:

Remote server -- > send POST along with HTTP header --- > My server (retrieves POST and HTTP headers) -- > Do additional processing

Probably this is very easy and I'm missing something I already know. But I tried any possibilities like cURL, $_SERVER variables but could not find one. Thanks for the help.

UPDATE: I would like to retrieve the X-Mandrill-Signature header sent by Mandrill in authenticating web hook request. You can read it here: http://help.mandrill.com/entries/23704122-Authenticating-webhook-requests

Upvotes: 0

Views: 541

Answers (1)

deceze
deceze

Reputation: 522005

Any and all received HTTP headers will be in $_SERVER['HTTP_*'], e.g. $_SERVER['HTTP_CONTENT_TYPE'] for the Content-Type header. It may get singled out into a different key, authentication headers typically don't have an HTTP_ prefix for instance.

Upvotes: 1

Related Questions