more demo updates
authorgggeek <giunta.gaetano@gmail.com>
Tue, 31 Jan 2023 18:50:31 +0000 (18:50 +0000)
committergggeek <giunta.gaetano@gmail.com>
Tue, 31 Jan 2023 18:50:31 +0000 (18:50 +0000)
demo/client/loggerinjection.php
demo/client/which.php

index 28331f7..bac3f08 100644 (file)
@@ -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.<br>");
 
 output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>");
+output("The client warning info is:<pre>\n" . $logger->getWarning() . "\n</pre>");
 output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>");
index 7a303b1..ec6c1de 100644 (file)
@@ -24,11 +24,11 @@ output("XML custom request:<br/><pre>" . htmlspecialchars($payload) . "</pre>\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');