$address = '方恒国际中心A座'
$city = '北京'
$key = 'd43b55fef15399d469c25c82079be3ee'; // 高德淘宝号shaoyikai登录创建
$url = 'http://restapi.amap.com/v3/geocode/geo?key=' . $key . '&address=' . $address. '&city=' . $city;
$AmapData = file_get_contents($url);
// $AmapData 为字符串:
// {"status":"1","info":"OK","infocode":"10000","count":"1","geocodes":[{"formatted_address":"北京市朝阳区方恒国际中心|A座","country":"中国","province":"北京市","citycode":"010","city":"北京市","district":"朝阳区","township":[],"neighborhood":{"name":[],"type":[]},"building":{"name":[],"type":[]},"adcode":"110105","street":[],"number":[],"location":"116.480656,39.989677","level":"门牌号"}]}
$res = json_decode($AmapData);
if($res->info === 'OK') {
$geocodes = $res->geocodes;
$location_2 = $geocodes[0]->location;
list($lon, $lat) = explode(',', $location_2);
}