$lat = $long = ''; if (isset($_POST['submit'])) { $key = "AIzaSyBtdwakOHGgJ8p9llMUHIdYCxvX2QWoZos"; $lat = $_POST['lat']; $long = $_POST['long']; $url = "https://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$long}&key={$key}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, 0); //Change this to a 1 to return headers curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); $data = json_decode($data, true); $sg->save_db_sitemap($data); if (isset($data['results'][0])) { $address = $data['results'][0]['formatted_address']; } else { $address = ''; } } ?> <h1>Reverse Geo Location</h1> <div class="pull-right"> <a href="index.html">Home </a> </div> <div class="row" style="margin-bottom: 10px;"> <form id="reverse-geo" role="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>