PHP code example of fleetlog / fleetlog-php
1. Go to this page and download the library: Download fleetlog/fleetlog-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fleetlog / fleetlog-php example snippets
$body = array(
'grant_type' => 'client_credentials',
'client_id' => 'yourCLientId',
'client_secret' => 'yourClientSecret'
);
$customHeaders = ['Content-type: application/x-www-form-urlencoded'];
$fleetlog = new \FleetlogAPI();
$resultBody = $fleetlog->request('token', 'POST', $body, $customHeaders);
echo json_encode($resultBody);
$fleetlog->setAccessToken($resultBody->access_token);
$vehicles = $fleetlog->request('vehicles', 'GET');
echo json_encode($vehicles);
$settings = array(
'oauth_access_token' => "your_access_token",
);
$requestMethod = 'GET';
$fleetlog = new FleetlogAPI($settings);
echo json_encode($fleetlog->request('vehicles/222', 'GET'));
$settings = array(
'oauth_access_token' => "your_access_token",
);
$requestMethod = 'GET';
$fleetlog = new FleetlogAPI($settings);
echo json_encode($fleetlog->request('vehicles/222/positions', 'GET'));