Page 1 of 1

PHP Accept-Language Headers?

Posted: Fri Nov 16, 2007 11:21 am
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?

Posted: Fri Nov 16, 2007 11:26 am
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'];?>

Posted: Fri Nov 16, 2007 11:55 am
by Jonah Bron
Cool. I'll keep that for future reference. :)