How to walk or drive using google maps using php

I have worked with Google maps before, but when I implemented it, I never found documentation on how to get the exact distance between two given locations via Javascript or PHP.

1) It should be the same distance shown on the maps, and not the formula that gives you the straight line distance from one geo-section to another.

2) It must be either PHP or Javascript

3) It should be Google maps, and not virtual land or something like that.

The best I came up with is to send an HTTP_GET request to Google maps using a long URL with variables, which then returns 200 and HTML code for the website. The distance is somewhere there, just need to filter.

But these resources are intense and heavy.

Does anyone know a better way?

EDIT: this is the function I'm talking about. The DLL is not included in the regular zip file for Windows, I found it as part of the WAMPserver software.

+4
source share
1 answer

This message gives a way and a warning.

To break it, you use Google maps to request such a URL

http://maps.google.com/maps?q=from+A+to+B&output=kml

and then you look at the data extracted from this URL (in kml format) and look at the tag labels (run it via simplexml), each tag tag will have a description that will have a text description of the next step in the route from A to B.

, Google T & C,

, Google , .

, .

+3