1. Go to this page and download the library: Download alexeydg/rzd-api 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/ */
alexeydg / rzd-api example snippets
// Добавляем прокси
$config = new Rzd\Config();
$config->setProxy([
'server' => '192.168.0.1',
'port' => '8080',
]);
// Изменяем userAgent
$config->setUserAgent('Mozilla 5');
// Изменяем referer
$config->setReferer('rzd.ru');
$api = new Rzd\Api($config);
// В примере выполняется поиск маршрута САНКТ-ПЕТЕРБУРГ - МОСКВА (только с билетами) на завтра
$params = [
'dir' => 0,
'tfl' => 3,
'checkSeats' => 0,
'code0' => '2004000',
'code1' => '2000000',
'dt0' => 'дата на завтра d.m.Y',
];
$routes = $api->trainRoutes($params);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.