PHP Accept-Language Headers?

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
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

PHP Accept-Language Headers?

Post by JAB Creations »

I'm trying to find documentation on how to use PHP to detect the Accept-Language header and I'm surprised I'm not finding anything documented or maybe I'm just not making the correct queries. So how do I detect what the visitor's language is in their Accept-Language headers?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

I remembered the $_SERVER predefined variable...and did a search...
http://www.google.com/search?hl=en&safe ... tnG=Search

So this works just nifty...

Code: Select all

<?php echo $_SERVER['HTTP_ACCEPT_LANGUAGE'];?>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Cool. I'll keep that for future reference. :)
Post Reply