In php, the ip address resolution of qq is obtained remotely to obtain the geographic location code. For more information, see.
The code is as follows:
Function get_ip_place ()
{
$ Ip = file_get_contents ("http://fw.qq.com/ipaddress ");
$ Ip = str_replace ('"','', $ ip );
$ Ip2 = explode ("(", $ ip );
$ A = substr ($ ip2 [1], 0,-2 );
$ B = explode (",", $ );
Return $ B;
}
I am sorry for all the news from the true XXX written in open-source China. We use regular expressions to write more easily.
Let's see.
The code is as follows:
Function get_ip_arr ()
{
$ Ip = file_get_contents ("http://fw.qq.com/ipaddress ");
Preg_match_all ("/\" (. *) \ "/", $ ip, $ arr );
Return $ arr;
}
The returned result is an array, which can be any region or ip address.
Of course, you can also read IP addresses through php. the advantage of this code is resource saving.