I am struggling to parse a geojson string returned from mapbox to get latitude and longitude co-ordinates, but struggling to get the data needed.
My current code is:
$json = file_get_contents($url);
$myPostcodeLat = $json->features[0]->center[0];
$myPostcodeLong = $json->features[0]->center[1];
I know the url is correct and is returning the data correctly, it is just the parsing of the data that is returned that isnt working for me.
I have tried a few of the other SO responses to parsing JSON data, but with no luck so far in getting the two required fields.