map.php 672 Bytes
<?php
print_r(getLatLng('台灣新北市'));
function getLatLng($address){
 
    // url encode the address
    $address = urlencode($address);
     
    // google map geocode api url
    $url = "http://maps.google.com/maps/api/geocode/json?address={$address}";	
    $curl = curl_init() ;
    curl_setopt($curl , 
            CURLOPT_URL , 
            "$url") ;
     
    curl_setopt($curl , CURLOPT_RETURNTRANSFER , 1) ;
         
    $info = curl_exec($curl) ;
 
    curl_close($curl) ;
	
	$a = json_decode($info);
	
	$latlng = array($a->results['0']->geometry->bounds->southwest->lat,$a->results['0']->geometry->bounds->southwest->lng);
	
	return $latlng;
    
}
?>
aaa