Login   Register  
PHP Classes
elePHPant
Icontem

Great Class but it has stopped working

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      distance class  >  All threads  >  Great Class but it has stopped working  >  (Un) Subscribe thread alerts  
Subject:Great Class but it has stopped working
Summary:updates possibel?
Messages:2
Author:Steve
Date:2013-09-12 12:27:47
Update:2013-12-17 14:04:34
 

  1. Great Class but it has stopped working   Reply   Report abuse  
Picture of Steve
Steve
2013-09-12 12:27:47
Hello after using the class for a day or two it stopped working. Is there any plans to update to Map API 3?

  2. Re: Great Class but it has stopped working   Reply   Report abuse  
Picture of Steve
Steve
2013-12-17 14:04:34 - In reply to message 1 from Steve
I updated this function and have this working again with V3 of the google API. You still must also include your API Key still just need to get a new ver 3 key.

distanceclass.php
[code]
function getCoords(&$location){
$loc = urlencode($location);
$url = "https://maps.googleapis.com/maps/api/geocode/json?address=$loc&sensor=false";
$json_result = json_decode(file_get_contents($url));

$geo_result = $json_result->results[0];

$citya = $geo_result->formatted_address;
$aCsv = $geo_result->geometry->location;


$aCsv = (array) ($aCsv);
$latitude = $aCsv['lat'];
$longitude = $aCsv['lng'];

if(isset($aCsv)) {
return array('lat'=>(float)$aCsv['lat'], 'lng'=>(float)$aCsv['lng'],);
}
return NULL;

}
[/code]