Home > Backend Development > PHP Tutorial > Code to obtain geographical location through IP under PHP (thief program)_PHP tutorial

Code to obtain geographical location through IP under PHP (thief program)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:28:25
Original
998 people have browsed it

Copy 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 a real XXX written by Open Source China. I am embarrassed to post the news. It is easier for us to write it with regular expressions

Let’s take a look
Copy 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, which can be anything Get the region or ip

Of course, you can also read the ip address through php. The advantage of this code is to save resources.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323584.htmlTechArticleCopy 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,-. ..
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template