Created
February 5, 2020 19:30
-
-
Save fqborges/4509d686d8873b2b6071d4b1113ae232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $API_KEY = "Solicitar via atendimento"; | |
| $url = "https://api.mobiltracker.com.br/trackers/233763/history/2019-02-05T000000Z"; | |
| // CHAVE DE API VIA QUERY STRING | |
| $url = "$url?apiKey=$API_KEY"; | |
| $context = null; | |
| // OU VIA HEADER | |
| // $context = stream_context_create(array( | |
| // 'http' => array( | |
| // 'header' => "Authorization: AuthDevice $API_KEY\r\n", | |
| // ) | |
| // ) | |
| // ); | |
| $result = file_get_contents($url, false, $context); | |
| if ($result === FALSE) { | |
| // Erro | |
| } | |
| else { var_dump($result); } | |
| // string(1234) "[ | |
| // {"latitude":-23.97782,"longitude":-48.877715,"speed":0.0,"timestamp":"2020-01-27T19:20:00Z"}, | |
| // {"latitude":-23.97790,"longitude":-48.877777,"speed":0.0,"timestamp":"2020-01-27T19:21:00Z","endTimestamp":"2020-01-27T19:25:00Z"}, | |
| // ... | |
| // ]" | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment