Jump to content

How to read custom Headers of incoming HTTP POST


rocksolidhq

Recommended Posts

Hey,

 

  i'm receiving some data from a remote source and they are passing on custom Headers with their HTTP POST data.

 

eg.

Host:DOMAIN.COM

Auth-MID:700000200109

Auth-TID:002

Auth-User:USER01

Auth-Password:PASSW0RD

Stateless-Transaction:true

Header-Record:false

 

  It seems easy enough to pull the standard header values like Host but i cannot seem to get at the custom ones.

 

Can anyone tell me how i would get them?

 

$_SERVER['HTTP_HOST'] retrieves "DOMAIN.COM" but $_SERVER['Auth-MID'] retrieves nothing.

 

thanks in advance,

dean

Link to comment
Share on other sites

Hey btherl,

 

  whoops, i should have described my environment.  It's actually an IIS 6 server.  Anyway, i also posed the question on the phpbuilder forum and received the answer.  Anyone searching can find it here:

 

http://www.phpbuilder.com/board/showthread.php?p=10888831#post10888831

 

the upshot is that all of the headers are stored in the $_SERVER array and capturing them is done using a line like:

 

$headerString = print_r($_SERVER, true); //the "true" tells print_r to return the output instead of displaying it.

 

thanks,

dean

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.