Copy CodeThe code is as follows:
function Getiploc_qq ($queryIP) {
$url = ' http://ip.qq.com/cgi-bin/searchip?searchip1= '. $queryIP;
$ch = Curl_init ($url);
curl_setopt ($ch, curlopt_encoding, ' gb2312 ');
curl_setopt ($ch, Curlopt_timeout, 10);
curl_setopt ($ch, Curlopt_returntransfer, true); Get Data back
$result = curl_exec ($ch);
$result = mb_convert_encoding ($result, "Utf-8", "gb2312"); encoding conversion, otherwise garbled
Curl_close ($ch);
Preg_match ("@ (.*)
@iU ", $result, $ipArray);
$loc = $ipArray [1];
return $loc;
}
Use
Echo getiploc_qq ("183.37.209.57"); You can get the address location where the IP address is located.
?>
http://www.bkjia.com/PHPjc/718618.html www.bkjia.com true http://www.bkjia.com/PHPjc/718618.html techarticle Copy the code as follows: Php function getiploc_qq ($queryIP) {$url = ' http://ip.qq.com/cgi-bin/searchip?searchip1= '. $queryIP; $ ch = curl_init ($url); curl_setopt ($ch, Curlopt_encod ...