2011-07-17 4 views

답변

2

curl는 ... 일부 스크립트에서 추출 .. 컬을위한 도우미 함수입니다

$address = str_replace(" ", "+", $_GET["address"]); 
$data = curl("https://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=false"); 
$data = json_decode($data, true); 
$json["city"] = $data["results"][0]["address_components"][2]["long_name"]; 
$json["country"] = $data["results"][0]["address_components"][3]["long_name"]; 
$json["iso"] = strtolower($data["results"][0]["address_components"][3]["short_name"]); 
$json["ll"] = $data["results"][0]["geometry"]["location"]["lat"].",".$data["results"][0]["geometry"]["location"]["lng"]; 
echo json_encode($json); 
관련 문제