Introduction to GeoIP:
What is GepIP?
The so-called GeoIP is to use the visitor's IP to locate his longitude and latitude, country/region, province, city, and even street location information. The technology here is not a difficult problem, the key lies in having an accurate database. With accurate data sources, you can earn a little money with rare goods, but what we pursue is to promote the spirit of cooperation and collective contribution for everyone to enjoy.
How to use GeoIP?
First we need data information, so first obtain a free database: GeoIP.dat.gz, and then decompress it to get: GeoIP.dat, and then operate the data file on demand. The example here uses PHP.
Usage of GeoIP + PHP
Method 1:
Download the PHP file geoip.inc of GeoIP. Package download
Copy the code The code is as follows:
include("geoip.inc.php");
// Open the data file
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
/ / Get the country code
$country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
echo "Your country code is: $country_code ";
// Get the country name
$country_name = geoip_country_name_by_addr($gi, $ _SERVER['REMOTE_ADDR']);
echo "Your country name is: $country_name ";
// Close the file
geoip_close($gi);
The above has introduced the photoshop practical tutorial and the php GeoIP usage tutorial, including the content of the photoshop practical tutorial. I hope it will be helpful to friends who are interested in PHP tutorials.