I
I
Ilya2018-05-18 12:24:13
PHP
Ilya, 2018-05-18 12:24:13

Why is json not being parsed?

There is an address, you need to know the coordinates. Does not work:

$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"];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
coderisimo, 2018-05-18
@sidorchik

because :
and, of course, you need to check whether the response contains the required data, and then process them, if any)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question