Building/Form: pop is updated when network is changed

This commit is contained in:
Frank Schubert
2021-07-15 22:48:35 +02:00
parent fa37cdd6e5
commit 8a8de499c6
4 changed files with 123 additions and 7 deletions

View File

@@ -30,15 +30,19 @@ class Gmaps_Geocoding {
$url .= "&components=$component_string";
}
$log->debug(__FILE__.": $url");
//$log->debug(__FILE__.": $url");
$resp = file_get_contents($url);
//print_r($resp);
if($resp) {
$json = json_decode($resp);
if($json->status != "OK") {
$log->warn(__FILE__.": No Results ($url)");
return false;
}
$results = $json->results;
if(count($results) > 1) {
$log->warn(__FILE__."> Got more then 1 result. Aborting.");
$log->warn(__FILE__.": Got more then 1 result. Aborting. ($url)");
return false;
}
$lat = $results[0]->geometry->location->lat;