PHP code example of jakoch / php-trac-rpc

1. Go to this page and download the library: Download jakoch/php-trac-rpc 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/ */

    

jakoch / php-trac-rpc example snippets






$credentials = array('username' => 'username', 'password' => 'password');

$trac = new \TracRPC\TracRPC('http://trac.example.com/login/jsonrpc', $credentials);

$result = $trac->getTicket('32');

if ($result === false) {
    die('ERROR: '.$trac->getErrorMessage());
} else {
    var_dump($result);
}

$trac->setMultiCall(true);

$ticket = $trac->getTicket('32');
$attachments = $trac->getTicketAttachments('list', '32');

$trac->doRequest();

$ticket = $trac->getResponse($ticket);
$attachments = $trac->getResonse($attachments);
var_dump($ticket, $attachments);