Maxmind's GeoIP is a very useful tool to identify the country where your Web site visitors are located. But once you have this geographic information, should you deal with it? A common application of this data is advertising that is distributed for geographic locations. The basic steps for using GEOIP data are quite simple-you read the remote IP address of the visitor, map the address to a country code (using the GEOIP Mapping database), and then use the country code to display the ad strips designed for that country. List A is a sample PHP script that shows these steps. This script assumes that you have a MySQL database that contains a list of ad bars and is indexed according to the country code. Once the client's IP is acquired through a dedicated $REMOTE_ADDR variable, the IP can be mapped to a country code. Then we use this country code to randomly select an ad bar for that country from the ad bar list. Pay particular attention to SQL queries-it first retrieves all the records that match the country code (the banner), and the country needs to be returned by the GEOIP_COUNTRY_CODE_BY_ADDR () method, and then randomly select one from each ad bar. (selected) The corresponding filename of the banner will be dynamically inserted into the HTML page. If you want, you can use this unique banner ID to further combine the banner with the click-Tracking script to count the success of your ad system. Other uses of geographic data targeted advertising is one of the most common applications of geodatabases. However, you can also use this information to accurately provide other types of content for (different) Users: Weather forecasts, security information, headlines, and so on. You can also use this data in other ways, such as rebooting users to content written in their native language, restricting/giving them access based on where they are located, or automatically adjusting the display of the cart to use the local currency. I will leave the discovery of this technology innovation application to you.
http://www.bkjia.com/PHPjc/531966.html www.bkjia.com true http://www.bkjia.com/PHPjc/531966.html techarticle Maxmind's GeoIP is a very useful tool to identify the country where your Web site visitors are located. But once you have this geographic information, should you deal with it? This data ...