取消https验证,并添加vendor文件夹。

This commit is contained in:
2025-04-18 12:58:39 +08:00
parent 552909d82b
commit 2d3f7d8511
727 changed files with 132015 additions and 19 deletions

49
vendor/daijie/aria2/Aria2.php vendored Normal file
View File

@@ -0,0 +1,49 @@
<?php
class Aria2
{
protected $ch;
protected $token;
function __construct($server='http://127.0.0.1:6800/jsonrpc', $token=null)
{
$this->ch = curl_init($server);
curl_setopt_array($this->ch, [
CURLOPT_POST=>true,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_HEADER=>false
]);
if(!is_null($token)) {
$this->token = $token;
}
}
function __destruct()
{
curl_close($this->ch);
}
protected function req($data)
{
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
return curl_exec($this->ch);
}
function __call($name, $arg)
{
if(!is_null($this->token)) {
array_unshift($arg, 'token:'.$this->token);
}
$data = [
'jsonrpc'=>'2.0',
'id'=>'1',
'method'=>'aria2.'.$name,
'params'=>$arg
];
$data = json_encode($data);
$response = $this->req($data);
if($response===false) {
trigger_error(curl_error($this->ch));
}
return json_decode($response, 1);
}
}