Does Cloudflare support Geolocation?

Summary

Cloudflare does indeed support Geolocation.

Click on the Network tab, and scroll down to see the following:

The data returned is the ISO 3166 2 letter alphabetical country code.

The read the two letter country code using PHP, use this script:

$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

Reference

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top