Home > Backend Development > PHP Tutorial > Dungeon Hunter 4 archive location code thief program to obtain geographical location through IP under PHP

Dungeon Hunter 4 archive location code thief program to obtain geographical location through IP under PHP

WBOY
Release: 2016-07-29 08:45:29
Original
1014 people have browsed it

Copy the code 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(",",$ a);
return $b;
}


The above is the real XXX written by Open Source China. I am embarrassed to post the news. It is easier to write it with regular expressions
Let’s take a look

Copy the code 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;
}


What is returned is an array, in which you can get the region or IP at will
Of course, you can also read the IP address through php. The advantage of this code is to save resources.

The above introduces the Dungeon Hunter 4 archive location code thief program that obtains geographical location through IP under PHP, including the Dungeon Hunter 4 archive location. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template