People like the data in php of latitude and longitude of this url below
https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0ozWRQqxiMnv5bqJzSUIMyUIIbMGrP5qu/message.json
People like the data in php of latitude and longitude of this url below
https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0ozWRQqxiMnv5bqJzSUIMyUIIbMGrP5qu/message.json
You can use the file_get_contents()
function. It would look something like:
$conteudo = file_get_contents('https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0ozWRQqxiMnv5bqJzSUIMyUIIbMGrP5qu/message.json');
echo $conteudo;
Since it is a JSON, we can transform it into an object using the json_decode($conteudo)
function. If you want to see the exact format of JSON you can use the following code
echo '<pre>';
print_r($conteudo);
echo '</pre>';
Now that you already have the content in an object, we can make a foreach
to go through all JSON content
foreach ($conteudo->response->feedMessageResponse->messages->message as $key) {
print_r('Latitude: '.$key->latitude);
echo ' - ';
print_r('longitude: '.$key->longitude);
echo '<br>';
}
The complete code looks like this:
$conteudo = json_decode(file_get_contents('https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0ozWRQqxiMnv5bqJzSUIMyUIIbMGrP5qu/message.json'));
foreach ($conteudo->response->feedMessageResponse->messages->message as $key) {
print_r('Latitude: '.$key->latitude);
echo ' - ';
print_r('longitude: '.$key->longitude);
echo '<br>';
}