PHP code example of umich-its-tl / viadutoo

1. Go to this page and download the library: Download umich-its-tl/viadutoo 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/ */

    

umich-its-tl / viadutoo example snippets


    /*
     * If necessary, use set_include_path() to ensure the directory
     * containing the "vendor" directory is in the PHP include path.
     */
    

    $proxy = (new MessageProxy())
        ->setTransportInterface(
            (new CurlTransport()) // Recommended transport with cURL, supports Basic Auth and OAuth 1.0
                ->setAuthZType(CurlTransport::AUTHZ_TYPE_OAUTH1, 'OAuth 1.0 key', 'OAuth 1.0 secret') // Optional authZ
        )
        ->setEndpointUrl('http://example.com/endpoint')
        ->setTimeoutSeconds(10)
        ->setAutostoreOnSendFailure(true)
        ->setStorageInterface(
            new MysqlStorage(
                'mysql.example.org', 'dbUser', 'dbPassword',
                'dbName', 'viadutoo_events'
            )
        );
    // ...
    try {
        $proxy
            ->setHeaders($headers)
            ->setBody($jsonBody)
            ->send();
    } catch (Exception $exception) {
        error_log($exception->getMessage());
    }