$content = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=Москва,%20ул.%20Академика%20Бочвара,%202");
$json = json_decode($content, true);
echo $json["results"]["geometry"]["location"]["lat"];
echo $json[0]["results"]["geometry"]["location"]["lat"];
{
"error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",
"results" : [],
"status" : "OVER_QUERY_LIMIT"
}
https://maps.googleapis.com/maps/api/geocode/json?key=QWERTY1234&address=Москва,%20ул.%20Академика%20Бочвара,%202
$content = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=Москва,%20ул.%20Академика%20Бочвара,%202");
$json = json_decode($content, true);
var_dump($json); // здесь будет весь массив данных
echo $json["results"][0]["geometry"]["location"]["lat"];
array(2) { ["results"]=> array(1) { [0]=> array(5) { ["address_components"]=> array(8) { [0]=> array(3) { ["long_name"]=> string(53) "Строительный Колледж №46, ГОУ" ["short_name"]=> string(53) "Строительный Колледж №46, ГОУ" ["types"]=> array(1) { [0]=> string(7) "premise" } } [1]=> array(3) { ["long_name"]=> string(1) "2" ["short_name"]=> string(1) "2" ["types"]=> array(1) { [0]=> string(13) "street_number" } } [2]=> array(3) { ["long_name"]=> string(25) "Ulitsa Akademika Bochvara" ["short_name"]=> string(25) "Ulitsa Akademika Bochvara" ["types"]=> array(1) { [0]=> string(5) "route" } } [3]=> array(3) { ["long_name"]=> string(38) "Severo-Zapadnyy administrativnyy okrug" ["short_name"]=> string(38) "Severo-Zapadnyy administrativnyy okrug" ["types"]=> array(3) { [0]=> string(9) "political" [1]=> string(11) "sublocality" [2]=> string(19) "sublocality_level_1" } } [4]=> array(3) { ["long_name"]=> string(6) "Moskva" ["short_name"]=> string(6) "Moskva" ["types"]=> array(2) { [0]=> string(8) "locality" [1]=> string(9) "political" } } [5]=> array(3) { ["long_name"]=> string(6) "Moskva" ["short_name"]=> string(6) "Moskva" ["types"]=> array(2) { [0]=> string(27) "administrative_area_level_2" [1]=> string(9) "political" } } [6]=> array(3) { ["long_name"]=> string(6) "Russia" ["short_name"]=> string(2) "RU" ["types"]=> array(2) { [0]=> string(7) "country" [1]=> string(9) "political" } } [7]=> array(3) { ["long_name"]=> string(6) "123182" ["short_name"]=> string(6) "123182" ["types"]=> array(1) { [0]=> string(11) "postal_code" } } } ["formatted_address"]=> string(107) "Строительный Колледж №46, ГОУ, Ulitsa Akademika Bochvara, 2, Moskva, Russia, 123182" ["geometry"]=> array(4) { ["bounds"]=> array(2) { ["northeast"]=> array(2) { ["lat"]=> float(55.8080289) ["lng"]=> float(37.4615495) } ["southwest"]=> array(2) { ["lat"]=> float(55.8072015) ["lng"]=> float(37.4604274) } } ["location"]=> array(2) { ["lat"]=> float(55.8078912) ["lng"]=> float(37.4611445) } ["location_type"]=> string(7) "ROOFTOP" ["viewport"]=> array(2) { ["northeast"]=> array(2) { ["lat"]=> float(55.808964180291) ["lng"]=> float(37.462337430291) } ["southwest"]=> array(2) { ["lat"]=> float(55.806266219708) ["lng"]=> float(37.459639469709) } } } ["place_id"]=> string(27) "ChIJZ08edGdItUYR5ZIU8dqfnME" ["types"]=> array(1) { [0]=> string(7) "premise" } } } ["status"]=> string(2) "OK" }
string(271) "{ "error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_", "results" : [], "status" : "OVER_QUERY_LIMIT" } "