Exemplo n.º 1
0
function GetMultiRequest_XmlRpc_Lib($host, $port, $passwd, $requestarr)
{
    global $ConnectTimeout;
    $c = new xmlrpc_client('xmlrpc', $host, $port);
    $c->setCredentials('nzbget', $passwd);
    $c->setDebug(False);
    $farr = array();
    foreach ($requestarr as $request) {
        $f = new xmlrpcmsg($request[0], ParamsLIB($request[1]));
        $farr[] = $f;
    }
    $ra = $c->multicall($farr, $ConnectTimeout);
    $rarr = array();
    $index = 0;
    foreach ($ra as $r) {
        if (!$r->faultCode()) {
            //Got a valid result, decode into php variables
            $rarr[] = php_xmlrpc_decode($r->value());
        } else {
            if (!strncmp($r->faultString(), 'Connect error: ', 15)) {
                return 'ERROR: ' . $r->faultString();
            }
            trigger_error('RPC: method "' . $requestarr[$index][0] . '", error ' . $r->faultCode() . ' - ' . $r->faultString());
        }
        $index++;
    }
    return $rarr;
}