I am having difficulty getting information from the Here Maps API (which deals with JSON). I am trying to convert the JSON to a string so it can be saved in a database.
Latitude and longitude is most important for my project.
$endereco = 'Rua Canapi 193, Guarulhos, Sao Paulo, Brasil';
$endereco = str_replace(" ", "+", $endereco);
$id = 'devportal-demo-20180625';
$cod = '9v2BkviRwi9Ot26kp2IysQ';
// https://geocoder.api.here.com/6.2/geocode.json?app_id=jz23R9Wi89IqwnnxZno0&app_code=g6DikMOdkOUyvGZN3kjW5A&searchtext=425+W+Randolph+Chicago
//$json = file_get_contents("http://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=$id&app_code=$cod&query=$endereco&gen=9");//
//$json = file_get_contents("https://geocoder.api.here.com/6.2/geocode.json?searchtext=$endereco&app_id=$id&app_code=$cod&gen=9");
$json = file_get_contents("https://geocoder.api.here.com/6.2/geocode.json?app_id=$id&app_code=$cod&searchtext=$endereco");
echo'<pre>';
//print_r($json = json_decode($json, true));
print_r($json = json_decode($json));
echo'</pre>';
//echo $json->{'suggestions'}[0]->{'label'};
//var_dump( $json->{'Response'}{'MetaInfo'}[0]->{'Timestamp'});
As you can see I'm trying with the different json url that exists in the documentation page Here maps api and there are other ways but what I want is the one that has latitude and longitude