REPORTINGurl = https://dtlocator.drivertech.com/api/key = API key (Required) format = return format for the report: (optional) xml ser (For info on serialized data, see https://www.php.net/manual/en/function.serialize.php) json (default) json encoding options: set to 1 to enable these options. JSON_HEX_TAG = All < and > are converted to \u003C and \u003E. JSON_HEX_AMP = All & are converted to \u0026. JSON_HEX_APOS = All ' are converted to \u0027. JSON_HEX_QUOT = All " are converted to \u0022. JSON_FORCE_OBJECT = (Enabled by default) Outputs an object rather than an array when a non-associative array is used. JSON_NUMERIC_CHECK = Encodes numeric strings as numbers. JSON_PRETTY_PRINT = Use whitespace in returned data to format it. JSON_UNESCAPED_SLASHES = Don't escape /. JSON_UNESCAPED_UNICODE = Encode multibyte Unicode characters literally (default is to escape as \uXXXX). JSON_PARTIAL_OUTPUT_ON_ERROR = Substitute some unencodable values instead of failing. JSON_PRESERVE_ZERO_FRACTION = Ensures that float values are always encoded as a float value. JSON_UNESCAPED_LINE_TERMINATORS = The line terminators are kept unescaped when JSON_UNESCAPED_UNICODE is supplied. JSON_INVALID_UTF8_IGNORE = Ignore invalid UTF-8 characters. JSON_INVALID_UTF8_SUBSTITUTE = Convert invalid UTF-8 characters to \0xfffd (Unicode Character 'REPLACEMENT CHARACTER') report = report type: (Required) l1 = location report for 1 unit l2 = location report for all units dn1 = devices nearby based on location of a unit dn2 = devices nearby based on lat/long "l1" report args: (location report for 1 unit) uid = unit id (Required) dailymileage = number of days to return showing mileage/day. Default is 0, max is 90 days. (optional) tripmeterresets = return tripmeter reset data. Multiple options available: (optional) A positive number will return that number of most recent resets. A negative number followed by minutes, hours, days will return all the resets within that time range. e.g. "-2 hours" or "-120 minutes" A date and time value will return all the resets since that time. e.g. "2025-12-06 19:16:37" A relative date/time format is also possible. e.g. "today" or "yesterday" or "last week" or "last month" positionhistory = return position history. Multiple options available: (optional) A positive number will return that number of most recent positions, max is 200. A negative number followed by minutes, hours, days will return all the positions within that time range. e.g. "-2 hours" or "-120 minutes" A date and time value will return all the positions since that time. e.g. "2025-12-06 19:16:37" A relative date/time format is also possible. e.g. "today" or "yesterday" "l2" report args: (location report for all units) positionhistory = return position history. Multiple options available: (optional) A positive number will return that number of most recent positions, max is 200. A negative number followed by minutes, hours, days will return all the positions within that time range. e.g. "-2 hours" or "-120 minutes" A date and time value will return all the positions since that time. e.g. "2025-12-06 19:16:37" A relative date/time format is also possible. e.g. "today" or "yesterday" "dn1" report args: (devices nearby based on location of a unit) uid = unit id (Required) distance = miles from the unit to search (Required) "dn2" report args: (devices nearby based on lat/long) lat = latitude (Required) long = longitude (Required) distance = miles from the unit to search (Required) |
TRIPMETERThe tripmeter function operates like the tripmeter in a car. You can reset it to track the mileage accumulated sincethe reset. The system will track the date/time of the reset and the approximate odometer reading. You can update the name/description of the reset making it easier to identify in the future and view all the tripmeter resets within the last X days. Tripmeter resets can be viewed with the "L1" report. TRIPMETER RESETReset the tripmeter to the current odometer reading and current date/time.url = https://dtlocator.drivertech.com/api/ key = API key (Required) tripmeter = "reset" (Required) uid = unit id (Required) name = name of the trip (Optional) https://dtlocator.drivertech.com/api/index.php?key=MyAPIKey&tripmeter=reset&uid=101234&name=Chicago%20trip TRIPMETER RENAMEName (or rename) a tripmeter reset. Giving a name like "Chicago trip" might make it easier to identify in the future.url = https://dtlocator.drivertech.com/api/ key = API key (Required) tripmeter = "rename" (Required) uid = unit id (Required) resetdate = the exact timestamp of the trip you wish to rename. (Required) newname = the (new) name of the trip. (Required) https://dtlocator.drivertech.com/api/index.php?key=MyAPIKey&tripmeter=rename&uid=101234&resetdate=2023-10-01%2015:30&newname=MyNewName |
<?php
# Set up data to send via json POST
$JSON_data = array(
'key' => 'YOUR_APIKEY_HERE',
'format' => 'json',
'report' => 'l1',
'uid' => '',
'positionhistory' => '',
'dailymileage' => '',
'tripmeterresets' => ''
);
# Set up options for cURL request
$curl_options = array(
CURLOPT_URL => 'https://dtlocator.drivertech.com/api/',
CURLOPT_POSTFIELDS => json_encode($JSON_data),
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
CURLOPT_RETURNTRANSFER => true
);
# Create a new cURL resource, set options, execute cURL request, get response and close handle.
$chandle=curl_init();
curl_setopt_array($chandle,$curl_options);
$response=curl_exec($chandle);
curl_close($chandle);
?>