Php code for Obtaining geographic locations through IP addresses (thieves program ). The copy code is as follows: functionget_ip_place () {$ ipfile_get_contents (fw. qq. comipaddress); $ ipstr_replace (, $ ip); $ ip2explode (, $ ip); $ asubstr ($ ip2 [1], 0 ,-
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.
The http://www.bkjia.com/PHPjc/323584.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323584.htmlTechArticle 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 ,-...