$api_key = ‘카카오 api키를 넣어주세요.’;
$address = urlencode(‘주소’);
$url = “https://dapi.kakao.com/v2/local/search/address.json?query=”.$address;
$headers = array(“Authorization:KakaoAK $api_key”);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
$content=json_decode($content,true);
$latlng = array();
$lat = $content[documents][0][‘address’][‘x’];
$lng = $content[documents][0][‘address’][‘y’];
//좌표값 $lat,$lng 를 원하는곳에 저장하여 이용하시면 됩니다.