PHP code example of filippo-toso / viaggia-treno

1. Go to this page and download the library: Download filippo-toso/viaggia-treno 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/ */

    

filippo-toso / viaggia-treno example snippets


use FilippoToso\ViaggiaTrenoAPI\Client as ViaggiaTreno;

// Create the client
$client = new ViaggiaTreno();

// Get the starting station and other details
$results = $client->cercaNumeroTrenoTrenoAutocomplete('8526');
var_dump($results);

// Get the current train status
$results = $client->andamentoTreno('S08409', '8526');
var_dump($results);

// Get the trian stops details
$results = $client->tratteCanvas('S08409', '8526');
var_dump($results);

// Get the station departures at specified time
$results = $client->partenze('S08409', '2017-10-13 21:43:00');
var_dump($results);