From 252decb678e097f86027d9eedbbe16d685ac28b7 Mon Sep 17 00:00:00 2001 From: gggeek Date: Tue, 31 Jan 2023 18:50:31 +0000 Subject: [PATCH] more demo updates --- demo/client/loggerinjection.php | 16 +++++++++++++++- demo/client/which.php | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/demo/client/loggerinjection.php b/demo/client/loggerinjection.php index 28331f78..bac3f083 100644 --- a/demo/client/loggerinjection.php +++ b/demo/client/loggerinjection.php @@ -16,6 +16,7 @@ class MyLogger { protected $debugBuffer = ''; protected $errorBuffer = ''; + protected $warningBuffer = ''; // logger API public function debug($message, $context = array()) @@ -23,12 +24,16 @@ class MyLogger $this->debugBuffer .= $message . "\n"; } - // logger API public function error($message, $context = array()) { $this->errorBuffer .= $message . "\n"; } + public function warning($message, $context = array()) + { + $this->warningBuffer .= $message . "\n"; + } + public function getDebug() { return $this->debugBuffer; @@ -38,6 +43,11 @@ class MyLogger { return $this->errorBuffer; } + + public function getWarning() + { + return $this->warningBuffer; + } } // create the custom logger instance @@ -60,6 +70,9 @@ $input = array( $encoder = new Encoder(); $client = new Client(XMLRPCSERVER); +// enable warnings for use of deprecated features +PhpXmlRpc::$xmlrpc_silence_deprecations = false; + // set maximum debug level, to have all the communication details logged $client->setDebug(2); @@ -73,4 +86,5 @@ $response = $client->send($request); output("Response received.
"); output("The client error info is:
\n" . $logger->getError() . "\n
"); +output("The client warning info is:
\n" . $logger->getWarning() . "\n
"); output("The client debug info is:
\n" . $logger->getDebug() . "\n
"); diff --git a/demo/client/which.php b/demo/client/which.php index 7a303b13..ec6c1de5 100644 --- a/demo/client/which.php +++ b/demo/client/which.php @@ -24,11 +24,11 @@ output("XML custom request:
" . htmlspecialchars($payload) . "
\n" $client = new Client(XMLRPCSERVER); // to support http redirects we have to force usage of cURL even for http 1.0 requests -$client->setUseCurl(Client::USE_CURL_ALWAYS); -$client->setCurlOptions(array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_POSTREDIR => 3)); +$client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_ALWAYS); +$client->setOption(Client::OPT_EXTRA_CURL_OPTS, array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_POSTREDIR => 3)); // if we know that the server supports them, we can enable sending of compressed requests -$client->setRequestCompression('gzip'); +$client->setOption(Client::OPT_REQUEST_COMPRESSION, 'gzip'); // ask the client to give us back xml $client->setOption(Client::OPT_RETURN_TYPE, 'xml'); -- 2.47.0