Get IP and geolocation class sharing in PHP, IP geolocation
Before we found a script that didn't finish, it simply expanded.Getting IP is using classic logic, and geo-targeting uses the generic interface of Sina.
The use of the method see source code:
Copy CodeThe code is a
list is as follows:
estimate
actual
ip geolocation service
1 hour to learn how to use service 1 hour to prepare database 1 hour to implement a fast algorithm for database lookup
fast, WCF Service is easy to learn half a hour for a binary search in database
Silverlight
IP geolocation Query class
/**
File name: IpLocation.class.php
* IP Geo-Location query class (Master file I'm uploading it.) I upload a test file, and there is a QQWry.Dat this can be downloaded to the pure IP library because there are more than 6M so here do not upload it up.
*
A gadget that displays IP geolocation information under Linux-naliFirst, IntroductionNali, the name is taken from the Chinese "where" pinyin. Nali contains a set of command-line programs whose main function is to attach the IP strings of the output of some network tools to the location information (using the Pure database QQWry.Dat). For example, 74.125.128.104 w
#./configure# Make make installIv. Updating IP databasesYou can use the Nali-update command to update the IP database/usr/local/share/qqwry.dat This file needs to be updated frequently, otherwise the error will be relatively large.V. Use of5.1. Nali# Nali 74.125.128.106# Nali 61.135.169.1055.2. Nali-dig# Nali-dig www.google.com5.3. Nali-nslookup# nali-nslookup www.google.com5.4. Nali-traceroute# Nali-trace
#./configure# Make make installIv. Updating IP databasesYou can use the Nali-update command to update the IP database/usr/local/share/qqwry.dat This file needs to be updated frequently, otherwise the error will be relatively large.V. Use of5.1. Nali# Nali 74.125.128.106# Nali 61.135.169.1055.2. Nali-dig# Nali-dig www.google.com5.3. Nali-nslookup# nali-nslookup www.google.com5.4. Nali-traceroute# Nali-trace
"title=" 10.jpg "alt=" Wkiom1vvtavisvxeaamv_hollcq887.jpg "/>In other words, Nali This command, you can attach the geo-information to the standard output IP. Similarly, if you do not like to use Nali-dig, then you can also use dig Ip|nali such commands.VI. AliasIf you think the input nali-xxx trouble, then you can do some alias, for example:# alias Traceroute= ' Nali-traceroute '# alias dig= ' Nali-dig '65
to dig |nali)Second, download# wget--no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gzThird, installation# tar ZXVF nali-0.2.tar.gz# CD nali-0.2#./configure# Make make installIv. Updating IP databasesYou can use the Nali-update command to update the IP database/usr/local/share/qqwry.dat This file needs to be updated frequently, otherwise the error will be relatively large.V. Use of5.1
This topic is a bit large, and I have to strictly control the number of words, not like the "Proposition composition: in a IPv4 address tree to thoroughly understand the IP routing table of the various search process" so open. In fact, this composition is an extension of the interval finding section in the previous essay.The 1.IP packet classification is the core of the
IP lookup domain name PHP source code. IP lookup domain names, usually bing's IP query function is used now, that is, IP: 222.222.222.222 is written as php code? Php call method $ resultgetResult (124.205.228.114); print _
Domain Name Lookup by IP address, which is usually an IP address query function of bing, that is, IP Address: 222.222.222.222Writing php code becomes// Call Method$ Result = getResult ("124.205.228.114 ");Print_r ($ result );Function getContent ($ url ){$ Content = file_get_contents ($ url );Return $ content;}Function
Original: https://redislabs.com/ebook/redis-in-action/part-2-core-concepts-2/ Chapter-5-using-redis-for-application-support/5-3-ip-to-city-and-country-lookupWhen we have collected statistical information and logs to Redis, we have collected information about the behavior of our system visitors. But we overlook an important part of visitor behavior-where do visitors come from? In this section we will build a set of functions to parse
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.