-1
I want to save the geographical coordinates of an address in the database. I can do this, but there is a.
I have a function that takes an address and returns the geographical coordinates of it. The problem is that as the function has an "echo" to display the coordinates and it is locking my application. Do you know how to make this function return the result without being through "echo" or do you know how to make the application not "stop" when going through "echo"?
Follows the function:
function getCoordinates($address){
$address = str_replace(" ", "+", $address); // replace all the white space with "+" sign to match with google search pattern
$url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=$address";
$response = file_get_contents($url);
$json = json_decode($response,TRUE); //generate array object from the response from the web
return ($json['results'][0]['geometry']['location']['lat'].",".$json['results'][0]['geometry']['location']['lng']);
}
echo getCoordinates($address);
Takes the
echo
. Other than that you can’t understand what you want.– Maniero
Gustavo, You can add other details to the question?
– Mega
@bigown, I simply want the result, the answer the function information, ie the coordinates, but echo stops my application... I’m using the function inside an application of mine!
– GustavoSevero
@Mega, what other details do you need? .
– GustavoSevero