if ($objlatlng1['status'] == "OK") { $lat1 = $objlatlng1['results']['0']['geometry']['location']['lat']; $lng1 = $objlatlng1['results']['0']['geometry']['location']['lng']; } else { echo "address 1 incorrect,please try again !!"; } $resp_latlnggoogle2 = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address={$newAddress2}&key=AIzaSyCqt0V2s8VlZHYEjC2k1k_rWhcSDVFxwfg"); $objlatlng2 = json_decode($resp_latlnggoogle2, true); if ($objlatlng2['status'] == "OK") { $lat2 = $objlatlng2['results']['0']['geometry']['location']['lat']; $lng2 = $objlatlng2['results']['0']['geometry']['location']['lng']; } else { echo "address 2 is incorrect, please try again !!"; } require_once 'rendezvousClass.php'; $data_rendezvous = new Rendezvous(); $result_latlong = $data_rendezvous->meetHalwayCalculation($lat1, $lng1, $lat2, $lng2); $latlong = explode(",", $result_latlong); $midlat = $latlong[0]; $midlong = $latlong[1]; $encryption = new Encryption(); $query = "lat=" . $encryption->encode($midlat) . "&lng=" . $encryption->encode($midlong) . "&rating=" . $encryption->encode($rating) . "&radius=" . $encryption->encode($radius) . "&lat1=" . $encryption->encode($lat1) . "&lng1=" . $encryption->encode($lng1) . "&lat2=" . $encryption->encode($lat2) . "&lng2=" . $encryption->encode($lng2); header('Location: meethalfwayoutput.php?' . $query); $uid = $data_rendezvous->getUserId($_SESSION['username']); $displayName = "{$address1},{$address2}"; $data_rendezvous->insertMeetSearch($uid, $midlat, $midlong, $rating, $radius, $displayName, $lat1, $lng1, $lat2, $lng2); } } ?> </body> </html>