Segue o código____________________________________
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Map On</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Localizacao: " + position.coords.latitude+","+ position.coords.longitude;
}
</script>
<?php
$teste = "<script>getLocation()</script>";
echo $teste;
$latAqui = explode(" ", $teste);
print_r($latAqui);
?>
Retorno até o presente momento_______________________________________
Localizacao: -22.3588937,-47.3859919
Array ( [0] => )