user8648577
user8648577

Reputation:

Transmission php class (How to get info of torrent)

I'm using the php transmission rpc class (https://github.com/brycied00d/PHP-Transmission-Class) to retrieve torrent info. But I don't know how to retrieve data from an array object (level 5). I retrieve data like $torrent_name = $result['arguments']['torrents'][0]['name'];

The Info I want is like :

$torrent_client_name = $result['arguments']['torrents'][0]['peers']['clientName'];

and here is the function,

 public function get ( $ids = array(), $fields = array() )
    {
    if ( !is_array( $ids ) ) $ids = array( $ids );
        if ( count( $fields ) == 0 ) $fields = array( "id", "name"); //this array
    $request = array(
    "fields" => $fields,
    "ids" => $ids
    );
    return $this->request( "torrent-get", $request );
    }

I tried to make something like this but no result:

$fields = array( "id", "name", array("peers"=>"clientName"));

or

$fields = array( "id", "name", array("clientName"));

or

$fields = array( "id", "name", 'peers' => array('clientName'));

The error I get :

Notice: Undefined index: peers

and here the var_dump($result);

Upvotes: 0

Views: 307

Answers (0)

Related Questions