PHP code example of sape / traffic-api-client
1. Go to this page and download the library: Download sape/traffic-api-client 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/ */
sape / traffic-api-client example snippets
in = 'YourLogin'; // Ваш логин в traffic.sape.ru
$token = 'a0d962dbcc73...'; // Ваш токен полученный на странице паспорта
$client = new \SapeRt\Api\Client\User;
$logger = new \Monolog\Logger('traffic');
$logger->pushHandler(new \Monolog\Handler\StreamHandler(STDOUT));
$client->setLogger($logger);
$data = $client->dictionary_dict(true);
echo var_export($data, true) . "\n";
try {
$res = $client->system_login($login, $token);
} catch (\SapeRt\Api\Exception\AppException $e) {
echo $e->getMessage();
}