Rob*_*cks 1 php scripting google-maps server-side driving-directions
对于我的应用程序,我需要一台服务器来计算行车路线
在谷歌地图API是专为只使用客户方,用JavaScript和Flash API.有什么办法可以运行他们的API服务器端吗?
据我所知,这不是官方的,谷歌不支持它,但它的工作原理:
$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);
Run Code Online (Sandbox Code Playgroud)
你将在$ data数组中有方向.