Using PHP to parse Googlemaps

babupathan

New Member
I have a site that I screen-scrape off GoogleMaps to get the driving distance from one point to another. It isn't heavily used (20 requests per week max), but Google's recent upgrade broke this functionality.I used to use this:

$url = 'http://maps.google.com/maps?f=d&hl=en&saddr='.$start.'&daddr='.$finish.'&output=xml';
$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$data = http://stackoverflow.com/questions/3727799/curl_exec ($ch);if(preg_match('!(\d+).*?.*?(\d+)[^\d]*(\d*)!si', $data, $matches))And it would return driving distance and total time. The new version of GoogleMaps broke this functionality and I'm trying to figure out a way to deal with the new API.
 
Back
Top