function geoConvert($zipCode) { $apiURL = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $zipCode . '&key=AIzaSyBTTsdHxs_5b51hmP-OKwsgvVtVZ2cbc9k'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $geoloc = json_decode(curl_exec($ch), true); // echo json_encode($geoloc); $lat = $geoloc['results'][0]['geometry']['location']['lat']; $lon = $geoloc['results'][0]['geometry']['location']['lng']; curl_close($ch); getPlaces($lat, $lon); }
</script> </head> <body> <form onsubmit='window.location.href="?from="+$("#from").get(0).value+"&to="+$("#to").get(0).value; return false;'> <div style='border:solid 3px gray; margin:10px; padding:10px;'> I'd like to travel from...<br/> <select name='from' id='from' onchange='selectSite(this.options[selectedIndex].value)'> <?php getPlaces($_GET['from']); ?> </select><br/> to...<br/> <select name='to' id='to' onchange='selectSite(this.options[selectedIndex].value)'> <?php getPlaces($_GET['to']); ?> </select><br/> </div> <div style='border:solid 3px gray; margin:10px; padding:10px;'> <input type='submit' value='Show me' /> </div> <form> <div style='border:solid 3px gray; margin:10px; padding:10px;'> <?php if (isset($_GET['from']) && isset($_GET['to'])) { getRoutes($_GET['from'], $_GET['to']); } ?> </div> <div id="credits"><?php
<div class="container"> <div class="row"> <div class="col-md-3"> </div> <div class="col-md-6"> <?php $pResult = getPlaces(1); if ($pResult != null && mysqli_num_rows($pResult) > 0) { echo "Results:<br>"; while ($row = mysqli_fetch_assoc($pResult)) { //echo "id: " . $row["ID_Place"]. " - Name: " . $row["Title"]. " " . $row["Description"]. "<br>"; echo "<a href='?page=place&place_id=" . $row["ID_Place"] . "'><b>" . $row["Title"] . "</b>: " . $row["Description"] . "</a><br><br><br>"; } } ?> </div> <div class="col-md-3"> </div> <div> </div>
<div class="container"> <div class="row"> <div class="col-md-3"> </div> <div class="col-md-6"> <?php $pResult = getPlaces(2); if ($pResult != null && mysqli_num_rows($pResult) > 0) { echo "Results:<br>"; while ($row = mysqli_fetch_assoc($pResult)) { //echo "id: " . $row["ID_Place"]. " - Name: " . $row["Title"]. " " . $row["Description"]. "<br>"; echo "<a href='?page=place&place_id=" . $row["ID_Place"] . "'><b>" . $row["Title"] . "</b>: " . $row["Description"] . "</a><br><br><br>"; } } ?> </div> <div class="col-md-3"> </div> <div> </div>