Sina: Http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
Return Data: var Remote_ip_info = {"ret": 1, "Start": "27.16.0.0", "End": "27.19.255.255", "Country": "U4e2du56fd", "Province": " u6e56u5317 "," City ":" U6b66u6c49 "," District ":" "," ISP ":" U7535u4fe1 "," type ":" "," desc ":" "}
Call method:
This interface seems to return to the IP corresponding to the national provinces and cities,
dynamically Nat, and Port multiplexing overload.conversion refers to the conversion of the private IP address of the internal network to a public IP address, the IP address pair is one-to-one, is immutable, a private
(! $fd = @fopen ($dat _path, ' RB ')) {
Return ' IP data file not exists or access denied ';
}
The EXPLODE function decomposes the IP address, and the integer result is computed.
$userip = Explode ('. ', $userip);
$useripNum = $userip [0] * 16777216 + $userip [1] * 65536 + $userip [2] * + + $userip [3];
Get IP
; otherwise, it will be written to the master route table.
4. create special routing rules
Ip rule can be used to view the current routing rules of the computer.
[Quote: 710319d809]
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
We can see that the rule contains three route ta
problem, several commands are used. You need to check the details for specific usage.
Ip route
Ip rule
Arp
Note: For ip command usage, please refer to the ip Chinese manual, which is available on www.google.com
1. bind an IP address
, the IP address pool. The IP addresses required by users to access the Internet come from this. When users access the Internet, assign an IP address from the IP address pool. When the
1, the way to use the interface:
This approach is relatively stable, and the data provided is relatively stable, providing a lot of interface, you can refer to
Http://www.hujuntao.com/api/the-ip-address-api-and-call-the-interface-method.html
Do not explain, only to explain the interface Sina provides:
Sina interface Address: http://int.dpool.sina.com.cn/iploo
IP address is different from that of John. The first method is a little more difficult and unreliable. when the other server upgrades the verification code one day, it will have to be followed up. there is a lot of trouble, while ISP (China Telecom, China Unicom, and China Mobile) has a lot of IP addresses, A new
)/7 + 1;$BeginNum = 0;$EndNum = $ipAllNum;Search for matching IP records from index records using the binary lookup methodwhile ($ip 1num> $ipNum | | $ip 2num$Middle = Intval (($EndNum + $BeginNum)/2);Offset pointer reads 4 bytes to index positionFseek ($FD, $ipbegin + 7 * $Middle);$ipData 1 = fread ($FD, 4);if (strlen
("^ [0-9]{1,3}.) {3} [0-9] {1,3}$ ", $userip)) {Return to ' IP address Invalid ';} Open IP Databaseif (! $fd = @fopen ($dat _path, ' RB ')) {Return ' IP data file not exists or access denied ';} The EXPLODE function decomposes the IP ad
.
4. DNS acquisition
Generally, DNS is provided by the local ISP, and a single phone can basically get the DNS server
5. Obtain the Gateway
How do I obtain the gateway address? You can use a MAC address scanner to scan network segments. First, manually set the
Based on the IP address of the Java implementation, can be \ t-delimited IP, address format (beginning ip\t end of the ip\t country \ \ \ n) into an ascending binary format, through a binary l
The code is as follows:
Function GetIP (){If (! Empty ($ _ SERVER ["HTTP_CLIENT_IP"]) {$ Cip = $ _ SERVER ["HTTP_CLIENT_IP"];}Elseif (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"]) {$ Cip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];}Elseif (! Empty ($ _ SERVER ["REMOTE_ADDR"]) {$ Cip = $ _ SERVER ["REMOTE_ADDR"];}Else {$ Cip = "cannot be obtained! ";}Return $ cip;}Echo GetIP ();?>
Here I have a public method to obtain the user
This article will introduce you to a new version of PHP to restart the vro to replace the IP address program. If you are interested in this, please refer to it. When collecting large volumes of data, the "self-protection" of the other server is often triggered, and access is restricted if the request is too frequent. In this case, the access can be restored after a long period of time (ranging from 10 minut
Introduction: This is a detailed page for retrieving the PHP version of the user's city and region using the Sina IP address library. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 327018 'rolling = 'no'>
/* $ IP = real_ip ();$ Url =
About getting the carrier's IP addressCurrently, ISP providers in China mainly include China Telecom, China Netcom (now connected with the Internet), and China Mobile (already merged with China tietong). The largest ISP is China Telecom and China Unicom (China Netcom ). Due to the differences between ISPs in the South and the North,
["HTTP_CLIENT_IP"];}Elseif (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"]) {$ Cip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];}Elseif (! Empty ($ _ SERVER ["REMOTE_ADDR"]) {$ Cip = $ _ SERVER ["REMOTE_ADDR"];}Else {$ Cip = "cannot be obtained! ";}Return $ cip;}Echo GetIP ();?>
Here I have a public method to obtain the user IP Address:
The Code is as follows:
Copy code
Function get_
One, about Taobao IP address library
The services we currently offer include:
1. According to the IP address provided by the user, the geographic and geographic information of the IP address is quickly queried, including the sta
Get IP Address
In PHP to get the current visitor's IP address, or relatively simple:
$ip = $_server[' REMOTE_ADDR ']
The above IP sometimes get no real IP
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.