IPアドレスから地理的位置を取得する(騰訊を利用してインタフェースを提供する)
369 ワード
<?php
function get_ip_place()
{
$ip = file_get_contents('http://fw.qq.com/ipaddress');
$ip = str_replace('"', '', $ip);
$ip = explode('(', $ip);
$ip = substr($ip[1], 0, -2);
$ip = explode(',', $ip);
return $ip;
}
// test
$ip = get_ip_place();
print_r($ip);
?>