GithubHelp home page GithubHelp logo

php-rtorrent-client's Introduction

PHP XMLRPC client for rtorrent

Provides a simple, composer-installable XMLRPC client for communicating with the rTorrent bittorrent client

Requirements

  • PHP 5.5.0
  • PHP curl extension
  • PHP xmlrpc extension

Installation

Installation through composer is recommended:

composer require phildier/php-rtorrent-client

Example usage

<?php

require_once("../vendor/autoload.php");

$client = new PHPRtorrentClient\Client(array('rpc_address'=>"http://localhost:8981/RPC2"));

$request = new PHPRtorrentClient\Request("system.listMethods");

$methods = $client->exec($request);

print_r($methods->getAll());

Resources

rTorrent XMLRPC references:

php-rtorrent-client's People

Contributors

blackout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

php-rtorrent-client's Issues

Error: Uncaught GuzzleHttp\Exception\ClientException: Client error: 400 in ...

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

rTorrent API how to get torrents info

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.