百度地图ak参数配置
$CONF = array( "ak" => "11Z8uiP8kIz6AG0Vjiwzb**" );
封装IP接口API
function getIp($ip, $ak) { $url = "http://api.map.baidu.com/location/ip?ak=" . $ak . "&ip=" . $ip . "&coor=bd09ll"; $res = file_get_contents($url); $b = json_decode($res, true); //echo "<pre>"; //var_dump($b); return $b["content"]["address"]; }
调用IP接口API
echo getIp("39.185.200.145", $CONF["ak"]);
Done!