I'm Ayesh Karunaratne, a freelance PHP/Drupal Web Developer and
a solo traveler.
I develop back-ends of awesome Drupal websites, built with performance, security and best practices in mind. Being a freelancer, I have plenty of time to travel. Currently living in Kandy, Sri Lanka, but the actual location may vary.
Thu, 2013-04-11 14:59
I'm a huge fan of CloudFlare and with recent SpamHaus DDoS attack, they have increased their reputation in their service.
If you are using CloudFlare, and in need to detect the visitor's language, I have a good news for you.
CloudFlare automatically makes available some variables that you can access server-side.
$country = $_SERVER['HTTP_CF_IPCOUNTRY'];
You will get the 2 letter short code of the country code, or
XX if CloudFlare failed to geolocate the user (See the list of ISO country codes).