Git project recommendation | IP address ing library-php Tutorial

Source: Internet
Author: User
Git project recommendation | ip address ing library ip2region-ip address to the region ing library. mom no longer needs to worry about my ip address location.

1. 99.9% accuracy, occasionally updated:

Data aggregates data from some well-known ip addresses to geographical name query providers. these are their official accuracy rates, which are much more accurate than pure ones. It takes one to two days for each aggregated data to be updated from time to time.

2. standardized data format:

The format of each ip data segment is fixed: _ City Id | country | region | province | city | ISP _

Only China's data is accurate to the city, and other countries can only locate the country. the previous options are all 0, and all the countries you can find are included.

(Ignore the previous City Id and personal project requirements)

3. small size:

The generated database file ip2region. db is only 3.5 MB

4. support for multi-query clients: query in milliseconds of 0.0x

Integrated clients include java, php, c, python, and php extensions (currently only linux is supported ).

Two query algorithms are provided. the response time is as follows: client/binary algorithm/B-tree algorithm: java/0. x millisecond/0. x millisecond (using RandomAccessFile) php/0. x millisecond/0.1x millisecond c/0.0x millisecond/0.0x millisecond (B-tree algorithm is basically stable at 0.02x millisecond level) python/0. x millisecond/0.1x millisecond

Any client B-tree is faster than the binary algorithm

5. test program: java:

cd binding/java    ant all    java -jar ip2region-{version}.jar ./data/ip2region.db

Php:

php binding/php/testSearcher ./data/ip2region.db

C:

cd binding/c/    gcc -g -O2 testSearcher.c ip2region.c    ./a.out ../../data/ip2region.db

Python:

python binding/python/testSearcher ./data/ip2region.db

The following page is displayed:

Initializing B-tree... + ---------------------------------- + | ip2region test script | Author: chenxin619315@gmail.com | Type 'quit' to exit program | + ---------------------------------- + p2region> 101.105.35.572163 | China | South China | Guangdong province | Shenzhen City | Dr. Peng in 0.02295 millseconds

Enter the IP address to start the test. The first test will be a little slow. after running the command, access binary to try the binary algorithm. we recommend that you use the B-tree algorithm.

For specific integration, see the test source code of different clients.

6. contact author:

The soul of the lion: chenxin619315@gmail.com

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.