Dzięki. Teraz jest ok.
Mam jeszcze jedno pytanie:
Mam taki kod JSON:
{
"debug_info" : [],
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "48",
"short_name" : "48",
"types" : [ "street_number" ]
},
{
"long_name" : "Pirrama Rd",
"short_name" : "Pirrama Rd",
"types" : [ "route" ]
},
{
"long_name" : "Pyrmont",
"short_name" : "Pyrmont",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Nsw",
"short_name" : "Nsw",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "AU",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "2009",
"short_name" : "2009",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "5/48 Pirrama Rd, Pyrmont Nsw, Australia",
"formatted_phone_number" : "(02) 9374 4000",
"geometry" : {
"location" : {
"lat" : -33.866933,
"lng" : 151.195791
}
},
Nie piszę wiecej kodu JSON.
Chcę teraz pobrać "long_name" : "Pyrmont",
Próbowałem pisać coś takiego:
$fullurl3 = "https://maps.googleapis.com/maps/api/place/details/json?reference=".$reference."&sensor=true&key=AIzaSyCWLmxpB756v-S2RYyYnJUMMXWgftQ3oHk";
$json_a3 = json_decode($string3, true); //json decoder
$namecity = $json_a3['results']['address_components'][3]['long_name'];
No ale nie wyświetla mi nic. Ktoś może pomóc ?
Pozdrawiam.