<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); $find = $_REQUEST['find'] ? $_REQUEST['find'] : 'piratebay'; $view = $_REQUEST['view'] ? $_REQUEST['view'] : 'main'; printf('Finding Torrents: Keyword: %s, View: %s<br>', $find, $view); $torrents = $client->getTorrentsByTracker($find, $view); printf('Total Torrents: %s<br>', count($torrents)); foreach ($torrents as $torrent) { printf('Torrent: %s<br>', $torrent->getName()); }
<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); var_dump($client->listMethods());
<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); foreach ($client->getTorrents() as $i => $torrent) { printf("%s: %s (%s), Running: %s, Label: %s\n", $i + 1, $torrent->getName(), $torrent->getHash(), $torrent->isActive() ? 'Yes' : 'No', $torrent->getLabel()); }
<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); $find = $_REQUEST['find'] ? $_REQUEST['find'] : 'family.guy'; $view = $_REQUEST['view'] ? $_REQUEST['view'] : 'main'; printf('Finding Torrents: Keyword: %s, View: %s<br>', $find, $view); $torrents = $client->getTorrentsByFile($find, $view); printf('Total Torrents: %s<br>', count($torrents)); foreach ($torrents as $torrent) { printf('Torrent: %s<br>', $torrent->getName()); //printf('Torrent: %s, Files: %s<br>', $torrent->getName(), implode(', ', $torrent->getFilesArray())); //printf('Torrent: %s, Trackers: %s<br>', $torrent->getName(), implode(', ', $torrent->getTrackerDomains())); }
<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); $torrent_file = sprintf('%s/%s', __DIR__, 'ubuntu-15.04-desktop-amd64.iso.torrent'); var_dump($client->load($torrent_file));
<?php require_once '../vendor/autoload.php'; $client = new \PHPRtorrentClient\Client(['rpc_address' => 'http://localhost:8981/RPC2']); var_dump($client->methodHelpAll());