Use CloudFlare as a source for IP2Locale module

Created on 7 December 2012, about 12 years ago
Updated 1 March 2023, almost 2 years ago

CloudFlare has a nice feature where they pass the country of the visitor in a HTTP header.

This can then be used by various modules, like the IP2Locale module http://drupal.org/project/ip2locale

To use the feature, and provide it to other modules, all you need is to add this bit at the end of cloudflare.module

// Extension for the backend of ip2locale.
function cloudflare_get_country(){
  return $_SERVER['HTTP_CF_IPCOUNTRY'];
}
Feature request
Status

Closed: outdated

Component

Code

Created by

🇩🇪Germany Gabriel R.

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024