Sometimes you just need to know what country your site visitors are coming from—for example, if you're trying to implement geo-targeted advertising. That's where a tool like MaxMind's GeoIP comes in—it lets you easily extract geographic data from your visitor's IP address.
MaxMind makes available both commercial and free databases; the commercial ones are extremely precise and can get as fine-grained as the user's city, while the free version can only identify the country of origin. We'll use the free version in this article. If you need more detailed information, such as the remote client's city and state of origin, you will need to purchase a more detailed database from MaxMind.