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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.