PHP code example of viharm / php-aria2-rpc
1. Go to this page and download the library: Download viharm/php-aria2-rpc library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
viharm / php-aria2-rpc example snippets
php compser.phar create-project viharm/php-aria2-rpc phpAria2rpc
var_dump($aria2->getGlobalStat());
var_dump($aria2->tellActive());
var_dump($aria2->tellWaiting(0,1000));
var_dump($aria2->tellStopped(0,1000));
var_dump($aria2->addUri(array('https://www.google.com.hk/images/srpr/logo3w.png'),array(
'dir'=>'/tmp',
)));
var_dump($aria2->tellStatus('1'));
var_dump($aria2->removeDownloadResult('1'));
//and more ...
$server = array (
'host' => 'aria2.host.local' ,
'port' => '6800' ,
'rpcsecret' => 'aria2rpcsecrettoken' ,
'secure' => TRUE ,
'cacert' => '/path/to/ca-cert/on/host/running/phpAria2.pem' ,
'rpcuser' => 'legacyrpcusername' ,
'rpcpass' => 'legacyrpcpassword' ,
'proxy' => array (
'type' => 'socks5' ,
'host' => 'localhost' ,
'port' => 9050 ,
'user' => 'proxyuser' ,
'pass' => 'proxypassword'
)
) ;
$addresult = $aria2->addUri ( array (
'https://www.google.com.hk/images/srpr/logo3w.png'
) ,
array('dir'=>'/tmp')
) ) ;
$GLOBALS['bl_DebugSwitch'] = TRUE ;