[eluser]Dani[/eluser]
Here is some code
Code:
function geolocation($address)
{
echo "address=".$address;
$sensor="false";
$address=urlencode($address);
$geoCodeURL="http://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor;=$sensor";
echo "<br>geoCodeURL=$geoCodeURL<br>";
$result = json_decode(file_get_contents($geoCodeURL), true);
echo "<hr>";print_r($result);
}
//output:
address=Nordre Torg 2 , 3513 Hønefoss , Norway
geoCodeURL=http://maps.googleapis.com/maps/api/geocode/json?address=Nordre+Torg+2,+3513+Hønefoss,+Norway&sensor=false
Array ( [results] => Array ( ) [status] => ZERO_RESULTS )
If I type the URL in the browser address field, it works fine and status = OK.