Everyone is learning
Go to this address to download the global IP segment http://ftp.apnic.net/apnic/dbase/data/country-ipv4.lst , inside cn is the Chinese IP range
Create a new php file called cnip.php, PHP obtains the specific code example of the Chinese IP range:
- < ?php
- $filefile = 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");
- }
- }
- }
- }
-
> ,If you are in a window environment, change the "n" in fputs($handle, $ipLines[0]. '-'. $ipLines[2]. "n"); to "rn" Line break.
http://www.bkjia.com/PHPjc/446128.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/446128.html
TechArticle
After learning, go to this address to download the global IP segment http://ftp.apnic.net/apnic/dbase /data/country-ipv4.lst, where cn is the Chinese IP range. Create a new php file called cnip.php. PHP is getting...