I would like to show a sidebar advert to users only in a specific location (San Francisco). Would I sniff their IP, then if it fits in the San Fran IP area create an If/Else to show. If the IP != San Fran IP location then don’t show?
Or do I not use IP to track their location these days?
The answer is the
whoisdatabase. Use thewhoiscommand on Linux, for example:Use the first “County” or “country” field. You will get the country of the network block which contains the IP. Try it at http://whois.domaintools.com/