output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) .
"\n\n</pre>Debug info of server data follows...\n\n");
$client = new Client(XMLRPCSERVER);
- $client->setDebug(1);
+ $client->setOption(Client::OPT_DEBUG, 1);
$resp = $client->send($req);
if (!$resp->faultCode()) {
$val = $resp->value();
$client = new Client(XMLRPCSERVER);
// tell the client we want back plain php values
-$client->return_type = XMLRPCParser::RETURN_PHP;
+$client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP);
// First off, let's retrieve the list of methods available on the remote server
output("<h3>methods available at http://" . $client->server . $client->path . "</h3>\n");
}
}
- $client->no_multicall = $avoidMulticall;
+ $client->setOption(Client::OPT_NO_MULTICALL, $avoidMulticall);
// Then, retrieve the signature and help text of each available method
foreach ($v as $methodName) {
$client->setDebug(2);
// avid compressed responses, as they mess up the output if echoed on the command-line
-$client->setAcceptedCompression('');
+$client->setOption(Client::OPT_ACCEPTED_COMPRESSION, '');
// send request
output("Sending the request. No output debug should appear below...<br>");
}
$client = new ParallelClient(XMLRPCSERVER);
-$client->no_multicall = true;
+$client->setOption(Client::OPT_NO_MULTICALL, true);
// a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and
// using a single system.multiCall request
echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n";
flush();
-$client->no_multicall = false;
+$client->setOption(Client::OPT_NO_MULTICALL, false);
$t = microtime(true);
$resp = $client->send($reqs);
$t = microtime(true) - $t;
}
// just in case this was set to something else
- $originalReturnType = $this->client->return_type;
- $this->client->return_type = 'phpvals';
+ $originalReturnType = $this->client->getOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE);
+ $this->client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, 'phpvals');
$resp = $this->client->send(new PhpXmlRpc\Request($this->prefix.$name, $args));
- $this->client->return_type = $originalReturnType;
+ $this->client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, $originalReturnType);
if ($resp->faultCode()) {
throw new \Exception($resp->faultString(), $resp->faultCode());
/**
* In case the remote method name has characters which are not valid as php method names, use this.
+ * (note that, in theory this is unlikely, as php has a broader definition for identifiers than xml-rpc method names)
*
* @param string $name remote function name. Will be prefixed
* @param array $arguments any php value will do. For xml-rpc base64 values, wrap them in a Value object
$client->setRequestCompression('gzip');
// ask the client to give us back xml
-$client->return_type = 'xml';
+$client->setOption(Client::OPT_RETURN_TYPE, 'xml');
$client->setDebug(1);
$c = new Client(XMLRPCSERVER);
// allow the full request and response to be seen on screen
-$c->setDebug(2);
+$c->setOption(Client::OPT_DEBUG, 2);
// tell the server not to compress the response - this is not necessary btw, it is only done to make the debug look nicer
-$c->accepted_compression = array();
+$c->setOption(Client::OPT_ACCEPTED_COMPRESSION, array());
// tell the server not to encode everything as ASCII - this is not necessary btw, it is only done to make the debug look nicer
-$c->accepted_charset_encodings = array('UTF-8');
+$c->setOption(Client::OPT_ACCEPTED_CHARSET_ENCODINGS, array('UTF-8'));
// force the client not to encode everything as ASCII - this is not necessary btw, it is only done to make the debug nicer
-$c->request_charset_encoding = 'UTF-8';
+$c->setOption(Client::OPT_REQUEST_CHARSET_ENCODING, 'UTF-8');
$r = $c->send(new Request('examples.stringecho', array(new Value($input))));
$output = $r->value()->scalarval();
');
$client = new PhpXmlRpc\Client(XMLRPCSERVER);
-$client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
+$client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, 'phpvals'); // let client give us back php values instead of xmlrpcvals
$resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
if ($resp->faultCode()) {
output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n");
"\$dm = require_once '$targetDispatchMapFile';\n" .
'$s = new \PhpXmlRpc\Server($dm, false);' . "\n" .
'// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" .
- '$s->setDebug(2);' . "\n" .
- '$s->exception_handling = 1;' . "\n" .
+ '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);' . "\n" .
+ '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);' . "\n" .
'$s->service();' . "\n"
) || die('uh oh');
));
// let the xml-rpc server know that the method-handler functions expect plain php values
-$srv->functions_parameters_type = 'phpvals';
+$srv->setOption(Server::OPT_FUNCTIONS_PARAMETERS_TYPE, 'phpvals');
// let code exceptions float all the way to the remote caller as xml-rpc faults - it helps debugging.
// At the same time, it opens a wide security hole, and should never be enabled on public or production servers...
PhpXmlRpc::$xmlrpc_null_extension = true;
$s = new Server($signatures, false);
-$s->setDebug(3);
+$s->setOption(Server::OPT_DEBUG, 3);
// Out-of-band information: let the client manipulate the server operations.
// We do this to help the testsuite script: *** do not reproduce in production or public environments! ***
if (defined('TESTMODE')) {
if (isset($_GET['RESPONSE_ENCODING'])) {
- $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
+ $s->setOption(Server::OPT_RESPONSE_CHARSET_ENCODING, $_GET['RESPONSE_ENCODING']);
}
if (isset($_GET['DETECT_ENCODINGS'])) {
PhpXmlRpc::$xmlrpc_detectencodings = $_GET['DETECT_ENCODINGS'];
}
if (isset($_GET['EXCEPTION_HANDLING'])) {
- $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
+ $s->setOption(Server::OPT_EXCEPTION_HANDLING, $_GET['EXCEPTION_HANDLING']);
}
if (isset($_GET['FORCE_AUTH'])) {
// We implement both Basic and Digest auth in php to avoid having to set it up in a vhost.