For my application I need a server to calculate driving directions.
The Google Maps API was designed for clientside use only, with a Javascript and Flash API. Is there any way I can run their API's server-side?
As I know it this isn't official and google doesn't support it but it works:
$url = str_replace(' ', '%20', "http://maps.google.com/maps/nav?client=yourclient&output=json&q=from: ".$lat1.",".$lon1." to: ".$lat2.",".$lon2);
$result = file_get_contents($url);
$data = json_decode(utf8_encode($result), true);
And you'll have directions in $data array.
来源:https://stackoverflow.com/questions/1800510/calculate-driving-directions-using-php