IP-GeoLocation with Cloudflare

roadhamster

Regular Member
Joined
Mar 12, 2012
Messages
362
Reaction score
261
Can't find a post about it, so here it is.
Cloudflare supports IP-GeoLocation. For a lot of people asking how to get the country through the visitors IP, for redirecting purposes based on country of origin, if you have your site on Cloudflare you can use Cloudflare's IP-GeoLocation. It's enabled by default in your CF's dashboard, and it's available from the Free plan.

CF_IPGEO.jpg

How to get it via PHP:CF_IPGEO_php.jpg
$geo will be the will be your 2 character country-code.

Due to posting custom tags error, I created an image for the code, sorry for that.


Nice feature, isn't it?

PS: mods, could you check why we can't include tags in our code? Got the following error while trying to submit post: You do not have permission to create tags. You may only use existing tags.
 
Last edited:
Yeah it's useful I use it when I'm targeting country specific. It's no good for city and state level but I use another service when I need that, which for what I do is rare.
 
Back
Top