The content of this article is about how PHP obtains its actual address based on IP (with examples). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
There are many tutorials on the Internet for obtaining the actual address based on the IP address
They provide many ready-made interfaces, for example:
Sina: 'http://int. dpool.sina.com.cn/...' . $ip
Taobao: "http://ip.taobao.com/service/getIpInfo.php?ip=".$ip
Wait for the interface to get the actual address based on the IP address, but these interfaces are very unstable. Here I recommend Baidu Map’s interface to get the actual address based on the IP. After testing, it is very fast and very stable
1: Log in to http://lbsyun.baidu.com/index... to get the secret key:
# #Fill in the relevant information to obtain a string of secret keys
2: Obtain the actual address information based on the interface address provided by Baidu MapHere is an example of ordinary IP positioning:Write the code to get the actual address based on the ip according to the tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
The above is the detailed content of How does php get its actual address based on ip (with example). For more information, please follow other related articles on the PHP Chinese website!