Api geocoding google

Автор: | 01.02.2021

$data = json_decode(file_get_contents(‘https://maps.googleapis.com/maps/api/geocode/json?&address=מצדה+7+בני+בק&key=XXXX&language=iw’));

//echo json_encode($data);
echo ‘<pre>’;
//var_dump($data->results[0]->address_components);
$test = array();
foreach ($data->results[0]->address_components as $item)
{
$test[] = $item->long_name;
}
print_r($test);

Раздел: Php