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
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.
*
Overview
This report summarizes a pair of programming projects. I (Lin Meng) and Li yazhao jointly completed this project.
The goal of the project is to obtain the geographical location information of the user through the user's IP address when the user accesses the academic map, so as to reposition the map and set the location of the user as the center currently displayed. This function is available on many network maps, such as Bing map and Googl
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
To do a query identification system, the goods need to be queried with the IP and the direction of the cargo to match. The problem is that it is accurate to use a computer to test IP access. I know the IP is randomly assigned, but Unicom is Unicom Telecom is telecommunications, network segment or fixed in a range.But I
PHP accurate method of obtaining the server IP address, PHP to obtain the server IP
In this paper, we describe the exact method of obtaining the server IP address by PHP. Share to everyone for your reference. The specific analysis is as follows:
In PHP, we generally live by $_server[' Http_host '] to the domain name o
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.