A PHP query IP location Code class, the first IP index offset address, the last IP index offset address, in order to be compatible with PHP5 the following version, this class does not use destructors, automatically shut down the IP library, the IP through Ip2long to IPv4 Internet address, Then compress him into a big-endian byte order to compare with the IP address in the index area.
First download the PHP query IP Location Code class library that we need to use in this lesson: http://www.php.cn/xiazai/leiku/541
After the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!
Once this is done, we will invoke this class in the new PHP file, and instantiate the class:
<?phpinclude_once ' ip.php ';//introduction of class file $ip=new iplocation ("Qqwry.dat");//Instantiate $address= $ip->getaddress (" 183.160.1.86 "), Echo ' <pre> ';p rint_r ($address);? >
Run this file and get the results as shown: