PHP code example of vohof / transmission
1. Go to this page and download the library: Download vohof/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/ */
vohof / transmission example snippets
$config = array(
'host' => 'http://127.0.0.1',
'endpoint' => '/transmission/rpc',
'username' => 'foo', // Optional
'password' => 'bar' // Optional
);
$transmission = new Vohof\Transmission($config);
// Add a torrent
$torrent = $transmission->add('magnet:?xt=urn:btih:335990d615594b9be409ccfeb95864e24ec702c7&dn=Ubuntu+12.10+Quantal+Quetzal+%2832+bits%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337');
// or
$content = base64_encode(file_get_contents('MyTorrent.torrent'));
$torrent = $transmission->add($content, true);
// Stop a torrent
$transmission->action('stop', $torrent['id']);
// Limit download speed
$transmission->set($torrent['id'], array('downloadLimit' => 100));
// Get torrent size
$transmission->get($torrent['id'], array('totalSize'));
// Remove torrent
$transmission->remove($torrent['id']););
// Remove torrent and its files
$transmission->remove($torrent['id'], true);
// Stats
$transmission->getStats();
'providers' => array(
...
'Vohof\TransmissionServiceProvider'
),
'aliases' => array(
...
'Transmission' => 'Vohof\TransmissionFacade'
)
Transmission::add($base64EncodedTorrent, true);
Torrent::stats();
class BuzzClient extends \Vohof\ClientAbstract {
...
}
$transmission = new Vohof\Transmission($config, new BuzzClient);
$ php artisan config:publish transmission --path=vendor/vohof/transmission/src/config