Everybody's learning.
Go to this address download global IP segment Http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst, CN is China IP segment range
Create a new PHP file called cnip.php,php get Chinese IP Segment specific code example:
- < ? PHP
- $ file file = File ('./country-ipv4.lst ');
- $ Handle = fopen ('./cnip.txt ', ' a ');
- if ($handle) {
- foreach ($file as $key => $val) {
- if (Strpos ($val, ' # ')!== 0) {
- $ Iplines = Explode (', $val);
- if ($ipLines [6] = = ' cn ') {
- Fputs ($handle, $ipLines [0]. '-'. $ipLines [2]. "N");
- }
- }
- }
- }
- ?>
Open cnip.txt China's IP segment range is completed by PHP to get the Chinese IP segment,
If it is in the window environment, the fputs ($handle, $ipLines [0]. '-'. $ipLines [2]. "N"); "N" in the Change to "RN" to break the line.
http://www.bkjia.com/PHPjc/446128.html www.bkjia.com true http://www.bkjia.com/PHPjc/446128.html techarticle Everyone is learning to go to this address to download the global IP segment http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst, inside CN is the IP segment range of China Create a new PHP file called cnip.php,php get in ...