phildier / php-rtorrent-client Goto Github PK
View Code? Open in Web Editor NEWPHP XMLRPC client for rtorrent
License: BSD 4-Clause "Original" or "Old" License
PHP XMLRPC client for rtorrent
License: BSD 4-Clause "Original" or "Old" License
How can I get info from a torrent (date added, progression, name, ...) ? I'm using the following lib : https://github.com/phildier/php-rtorrent-client
The software for torrent is rTorrent.
So far I have made (I can list all hash of my torrents) :
<?php
require '../3rdparty/php-rtorrent-client-master/vendor/autoload.php';
$client = new \PHPRtorrentClient\Client([
'rpc_address' => "https://myuser:[email protected]:32491/RPC2",
]);
$request = new PHPRtorrentClient\Request("download_list");
$methods = $client->exec($request);
$torrents = $methods->getAll();
var_dump($torrents);
Result :
array(1) {
["download_list"]=> array(58) {
[0]=> string(40) "5AAEAAS44AAF97BF57BB24CA4FA4471AVF4A1F4F"
[1]=> string(40) "546AAAA41013ED213B6DFFZZDDFZ744157ZSAADA"
[2]=> string(40) "94774458AAA111AA7531BFAD46972666ED2D139A"
}
}
rTorrent doc : https://mdevaev.github.io/emonoda/rTorrent-XMLRPC-Reference
I tried to list the torrents with (https://github.com/phildier/php-rtorrent-client/blob/master/examples/get_torrents.php):
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());
}
But all I'm getting is :
Notice: Undefined offset: 0 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Response.php on line 116
Notice: Undefined offset: 0 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Response.php on line 130
Notice: Undefined index: getName in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: get_name in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): getName in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: getHash in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: get_hash in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): getHash in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: isActive in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: is_active in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): isActive in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: getLabel in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Warning: Illegal string offset 'get_custom1' in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 35
1: (), Running: No, Label: -
Notice: Undefined index: getName in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: get_name in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): getName in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: getHash in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: get_hash in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): getHash in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: isActive in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Notice: Undefined index: is_active in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 110
Notice: Undefined property via __call(): isActive in /.../step1.php on line 43 in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 40
Notice: Undefined index: getLabel in /.../php-rtorrent-client-master/src/PHPRtorrentClient/Base.php on line 46
Cheers
Hello,
I'm trying to use the API but I'm facing an error. Here is my code :
<?php
require '../../3rdparty/php-rtorrent-client-master/vendor/autoload.php';
$client = new PHPRtorrentClient\Client(array('rpc_address'=>"http://username:password@IP_ADDRESS:PORT"));
$request = new PHPRtorrentClient\Request("system.listMethods");
$methods = $client->exec($request);
print_r($methods->getAll());
Full error I'm getting :
<br />
<b>Fatal error</b>: Uncaught GuzzleHttp\Exception\ClientException: Client error: 400 in /.../php-rtorrent-client-master/vendor/guzzlehttp/guzzle/src/Middleware.php:68
Stack trace:
#0 /.../php-rtorrent-client-master/vendor/guzzlehttp/promises/src/Promise.php(199): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 /.../php-rtorrent-client-master/vendor/guzzlehttp/promises/src/Promise.php(165): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#2 /.../php-rtorrent-client-master/vendor/guzzlehttp/promises/src/FulfilledPromise.php(39): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Object(GuzzleHttp\Psr7\Response))
I also tried with the following address :
Cheers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.