Hello everyone: I have a simple text field and a button. In the text field the user can enter an address and when I press the button, what I do is geocode the address to get the geographical coordinates. To get them I do the following:
<? Php
If ($ _POST) {
$ Url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=";
$ Address = $ _POST ['address'];
$ Call = $ url.urlencode ($ address);
$ Response = json_decode (file_get_contents ($ call), true);
If ($ response ['status']! = 'OK') {
Echo "It was not possible to geocode the address. Please re-enter the data.";
Exit;
}
}
?>
Now, I know that in the response variable I have the coordinates, but I do not know how to display them, how to get them ... Can you give me a hand?
PS: I tried to put a variable "$ length" and I made a "count ($ response)" and it returned a "2" that is, there are the coordinates but I do not know how to recover them !!!