PHP code example of willicab / transmission
1. Go to this page and download the library: Download willicab/transmission 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/ */
willicab / transmission example snippets
Willicab\Transmission\Client;
$tm = new Client();
$tm->connect();
Willicab\Transmission\Client;
$arguments = [
'host' => 'http://another.host',
'port' => 1234,
'user' => 'transmission',
'password' => 'transmission'
];
$tm = new Client($arguments);
$tm->connect();
$tm->torrentStart();
$tm->torrentStartNow(1);
$tm->torrentStop([1, 3, '3343d0e7c66f29d2f0ce9af951d367020eedc38c']);
$tm->torrentVerify('recently-active');
$tm->torrentReannounce('3343d0e7c66f29d2f0ce9af951d367020eedc38c');
$arguments = [
'downloadLimit' => 1000,
'downloadLimited' => true,
];
$tm->torrentSet(2, $arguments);
$tm->torrentSet(1, $arguments);
$tm->torrentSet([1, 3, '3343d0e7c66f29d2f0ce9af951d367020eedc38c'], $arguments);
$tm->torrentSet('recently-active', $arguments);
$arguments = ['id, 'name', 'downloadLimit', 'downloadLimited'];
$tm->torrentGet(2, $arguments);
$tm->torrentGet(1, $arguments);
$tm->torrentGet([1, 3, '3343d0e7c66f29d2f0ce9af951d367020eedc38c'], $arguments);
$tm->torrentGet('recently-active', $arguments);
$arguments = [
'download-dir' => '/home/user/Downloads/',
'paused' => true,
];
$tm->addFilename('magnet:?xt=urn:btih:c39fe3eefbdb62da9c27eb6398ff4a7d2e26e7ab&dn=Big.Buck.Bunny.BDRip.XviD-MEDiC&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', $arguments);
$tm->addFilename('https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-9.5.0-amd64-DVD-1.iso.torrent', $arguments);
$arguments = [
'download-dir' => '/home/user/Downloads/',
'paused' => true,
];
$tm->addMetainfo('ZDg6YW5ub3VuY2U0MTpodHRwOi8vYnR0cmFja2VyLmRlYmlhbi5vcmc6Njk ... wnJ273LLn4nZC2PNVQvHbmy89ucgL8I2QDGQZWU=', $arguments);
$tm->torrentRemove(2); // remove from list
$tm->torrentRemove('3343d0e7c66f29d2f0ce9af951d367020eedc38c', true); // remove from list and delete the files
$tm->torrentSetLocation(1, '/home/user/Downloaded/', true);
$tm->torrentRenamePath(1, '/home/user/Downloads/The Torrent', '/home/user/Downloaded/My Torrent');
$arguments = [
'download-dir' => '/home/user/Downloads/',
'start-added-torrents' => true,
];
$tm->sessionSet($arguments);
$tm->sessionGet();
$tm->sessionStats();
$tm->blocklistUpdate();
$tm->portTest();
$tm->sessionClose();
$tm->queueMove(1, 'top');
$tm->queueMove([2, 3], 'up');
$tm->queueMove('3343d0e7c66f29d2f0ce9af951d367020eedc38c', 'down');
$tm->queueMove(2, 'bottom');
$tm->freeSpace('/home/user/Downloads/');