2
rtorrent 정보를 얻을 ...PHP는 xmlrcp 클라이언트 내 rtorrent 인스턴스의 일부 정보를 얻기를 위해 간단한 PHP 스크립트를 작성해야
이는 ... 내가 코드를 많이 시도하지만 난 결코 responce을주지 내 마지막 테스트
ini_set('display_errors', 1);
error_reporting(E_ALL);
function do_call($host, $port, $request) {
$url = "http://$host:$port";
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$data = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
return $data;
}
}
$host = '127.0.0.1';
$port = 10001;
$request = xmlrpc_encode_request("system.listMethods()", null);
$response = do_call($host, $port, $request);
var_dump($response);
간단한 테스트 코드가 있습니까?