function getLatLng() { $streetAddress = $_GET['streetAddress']; $city = $_GET['city']; $state = $_GET['state']; $urlstreetAdd = urlencode($streetAddress); $urlCity = urlencode($city); $geoCodingLink = "https://maps.googleapis.com/maps/api/geocode/xml?address=" . $urlstreetAdd . "," . $urlCity . "," . "{$state}"; $geoCodeContent = simplexml_load_file($geoCodingLink); if ($geoCodeContent->status == "OK") { $lat = $geoCodeContent->result->geometry->location->lat; $lng = $geoCodeContent->result->geometry->location->lng; $result = getForecast($lat, $lng); return $result; } else { return 101; //invalid address } }
$row["{$i}{$year}"] = number_format($row["{$i}{$year}"]); $row["{$i}{$prevYear}"] = number_format($row["{$i}{$prevYear}"]); $row["{$i}{$nextYear}"] = number_format($row["{$i}{$nextYear}"]); } $row["t{$comp}"] = getForecast($row["t{$year}"]); $row["t{$year}"] = number_format($row["t{$year}"]); $row["t{$prevYear}"] = number_format($row["t{$prevYear}"]); $row["t{$nextYear}"] = number_format($row["t{$nextYear}"]); $ndata["{$city}"]['data'][] = $row; } $totals["t{$comp}"] = getForecast($totals["t{$year}"]); $totals["t{$year}"] = number_format($totals["t{$year}"]); $totals["t{$prevYear}"] = number_format($totals["t{$prevYear}"]); $totals["t{$nextYear}"] = number_format($totals["t{$nextYear}"]); for ($k = 1; $k < 5; $k++) { $totals["{$k}{$comp}"] = getForecast($totals["{$k}{$year}"]); $totals["{$k}{$year}"] = number_format($totals["{$k}{$year}"]); $totals["{$k}{$prevYear}"] = number_format($totals["{$k}{$prevYear}"]); $totals["{$k}{$nextYear}"] = number_format($totals["{$k}{$nextYear}"]); } $ndata["{$city}"]['totals'] = $totals; } $mysqli->close(); //dump($ndata); $printPage = TRUE; foreach ($ndata as $city => $d) { $cityName = $city; if ($printPage === FALSE) { $pdf->Ln(2); $pdf->printTitle(); }