rocksolidhq Posted October 6, 2008 Share Posted October 6, 2008 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 https://forums.phpfreaks.com/topic/127170-how-to-read-custom-headers-of-incoming-http-post/ Share on other sites More sharing options...
btherl Posted October 6, 2008 Share Posted October 6, 2008 This looks like what you are looking for: apache_request_headers() Assuming you are using apache. Link to comment https://forums.phpfreaks.com/topic/127170-how-to-read-custom-headers-of-incoming-http-post/#findComment-657948 Share on other sites More sharing options...
rocksolidhq Posted October 7, 2008 Author Share Posted October 7, 2008 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 https://forums.phpfreaks.com/topic/127170-how-to-read-custom-headers-of-incoming-http-post/#findComment-658885 Share on other sites More sharing options...
Orio Posted October 7, 2008 Share Posted October 7, 2008 Why are you using print_r()? Just use the $_SERVER array... With print_r() you'll receive back a formatted string. Orio. Link to comment https://forums.phpfreaks.com/topic/127170-how-to-read-custom-headers-of-incoming-http-post/#findComment-658891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.