Example of implementation of PHP query IP location

Source: Internet
Author: User
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.