ndthuan/aria2-rpc-adapter

PHP 的 Aria2 RPC 适配器

0.1.1 2016-03-20 14:52 UTC

This package is auto-updated.

Last update: 2024-09-12 04:12:13 UTC


README

简单的 Aria2 RPC 适配器。关于 Aria2 的更多信息: https://aria2.github.io/.

如何启用 RPC 模式

  • 简单模式: aria2c --enable-rpc --rpc-listen-all
  • 令牌启用模式: aria2c --enable-rpc --rpc-listen-all --rpc-secret=MySecretToken

适配器使用示例

<?php

require 'vendor/autoload.php';

$client = new \JsonRPC\Client('https://:6800/jsonrpc');
$adapter = new \Ndthuan\Aria2RpcAdapter\Adapter($client);

print_r(
    $adapter->getGlobalStat()
);

var_dump(
    $adapter->addUri(
        ['http://google.com'],
        ['dir' => getenv('HOME') . '/Downloads']
    )
);

print_r(
    $adapter->tellActive()
);