本文整理汇总了PHP中rXMLRPCRequest::send方法的典型用法代码示例。如果您正苦于以下问题:PHP rXMLRPCRequest::send方法的具体用法?PHP rXMLRPCRequest::send怎么用?PHP rXMLRPCRequest::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rXMLRPCRequest
的用法示例。
在下文中一共展示了rXMLRPCRequest::send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rXMLRPCRequest
break;
case "getchunks":
$req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_bitfield", $hash[0]), new rXMLRPCCommand("d.get_chunk_size", $hash[0]), new rXMLRPCCommand("d.get_size_chunks", $hash[0])));
if (rTorrentSettings::get()->apiVersion >= 4) {
$req->addCommand(new rXMLRPCCommand("d.chunks_seen", $hash[0]));
}
if ($req->success()) {
$result = array("chunks" => $req->val[0], "size" => $req->val[1], "tsize" => $req->val[2]);
if (rTorrentSettings::get()->apiVersion >= 4) {
$result["seen"] = $req->val[3];
}
}
break;
default:
if (isset($HTTP_RAW_POST_DATA)) {
$result = rXMLRPCRequest::send($HTTP_RAW_POST_DATA);
if (!empty($result)) {
$pos = strpos($result, "\r\n\r\n");
if ($pos !== false) {
$result = substr($result, $pos + 4);
}
cachedEcho($result, "text/xml");
}
}
break;
}
if (is_null($result)) {
header("HTTP/1.0 500 Server Error");
cachedEcho(isset($req) && $req->fault ? "Warning: XMLRPC call is failed." : "Link to XMLRPC failed. May be, rTorrent is down?", "text/html");
} else {
cachedEcho(json_encode($result), "application/json");
示例2: rtAddTorrent
function rtAddTorrent($fname, $isStart, $directory, $label, $dbg = false)
{
if ($isStart) {
$method = 'load_start_verbose';
} else {
$method = 'load_verbose';
}
if ($dbg) {
rtDbg(__FUNCTION__, "1" . $fname);
}
$torrent = new Torrent($fname);
if ($dbg) {
rtDbg(__FUNCTION__, "2");
}
if ($torrent->errors()) {
if ($dbg) {
rtDbg(__FUNCTION__, "fail to create Torrent() object");
}
return false;
}
if ($directory && strlen($directory) > 0) {
$directory = rtMakeStrParam("d.set_directory=\"" . $directory . "\"");
} else {
$directory = "";
}
$comment = $torrent->comment();
if ($comment && strlen($comment) > 0) {
if (isInvalidUTF8($comment)) {
$comment = win2utf($comment);
}
if (strlen($comment) > 0) {
$comment = rtMakeStrParam("d.set_custom2=VRS24mrker" . rawurlencode($comment));
if (strlen($comment) > 4096) {
$comment = '';
}
}
} else {
$comment = "";
}
if ($label && strlen($label) > 0) {
$label = rtMakeStrParam("d.set_custom1=\"" . rawurlencode($label) . "\"");
} else {
$label = "";
}
$addition = "";
global $saveUploadedTorrents;
$delete_tied = $saveUploadedTorrents ? "" : rtMakeStrParam("d.delete_tied=");
$content = '<?xml version="1.0" encoding="UTF-8"?>' . '<methodCall>' . '<methodName>' . $method . '</methodName>' . '<params>' . '<param><value><string>' . $fname . '</string></value></param>' . $directory . $comment . $label . $addition . $delete_tied . '</params></methodCall>';
//if( $dbg ) rtDbg( __FUNCTION__, $content );
$res = rXMLRPCRequest::send($content);
if ($dbg && !empty($res)) {
rtDbg(__FUNCTION__, $res);
}
if (!$res || ($res = '')) {
return false;
} else {
return $torrent->hash_info();
}
}