HTTP Request Headers containing underscores and hyphens

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Martian
Forum Newbie
Posts: 2
Joined: Mon Aug 10, 2009 5:22 am

HTTP Request Headers containing underscores and hyphens

Post by Martian »

Hi, I imagine someone has come across this problem before.

I'm receiving custom HTTP headers from a WAP Gateway. The headers contain a mixture of "_" and "-" characters. I have some PHP which does some processing before making an ongoing request to another application. The PHP needs to pass all headers received to the downstream application. However all "-" in header names have been converted to "_" by PHP before being stored in the $_SERVER global. So I don't know which were "-" and which were "_" when I make the ongoing request using the headers stored in $_SERVER.

Any ideas on how to solve this problem would be greatly appreciated.
User avatar
turbolemon
Forum Commoner
Posts: 70
Joined: Tue Jul 14, 2009 6:45 am
Location: Preston, UK

Re: HTTP Request Headers containing underscores and hyphens

Post by turbolemon »

You using Apache? You could try this http://us3.php.net/manual/en/function.a ... eaders.php. It doesn't mention whether or not it mauls the header names, but it's worth a try.
Martian
Forum Newbie
Posts: 2
Joined: Mon Aug 10, 2009 5:22 am

Re: HTTP Request Headers containing underscores and hyphens

Post by Martian »

Thanks turbolemon, that did the trick.
Post Reply