here is the html code
<script src="http://maps.google.com/maps?file=api&v=2&key=" type="text/javascript"></script>
<!-- According to the Google Maps API Terms of Service you are required display a Google map when using the Google Maps API. see: http://code.google.com/apis/maps/terms.html -->
<script type="text/javascript">
var geocoder, location1, location2, gDir;
function initialize() {
geocoder = new GClientGeocoder();
gDir = new GDirections();
GEvent.addListener(gDir, "load", function() {
var drivingDistanceKilometers = gDir.getDistance().meters / 1000;
document.getElementById('results').innerHTML = drivingDistanceKilometers;
});
}
function showLocation() {
geocoder.getLocations(add1, function (response) {
location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
geocoder.getLocations(add2, function (response) {
location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
//gDir.load('from: ' + location1.address + ' to: ' + location2.address);
gDir.load('from:' + location1.address + ' to: ' + location2.address);
});
});
}
</script>
</head>
<body onload="initialize();showLocation()">
<p id="results"></p>
</body>
the output will be somthing like this,1.625
when file_get_contents() the html link in php,it will get all the html include title,but not the result 1.625 ,
hope you understand my english