Refactor the Wrapper class to generate closures by default and avoid usage of 'eval'
[plcapi.git] / demo / client / simple_call.php
index 8a36ece..4e904be 100644 (file)
@@ -2,10 +2,13 @@
 /**
  * Helper function for the terminally lazy.
  *
- * @copyright (c) 2006-2014 G. Giunta
- * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
+ * @copyright (c) 2006-2015 G. Giunta
+ * @license code licensed under the BSD License: see file license.txt
  */
 
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
 /**
  * Takes a client object, a remote method name, and a variable numbers of
  * php values, and calls the method with the supplied parameters. The
@@ -43,11 +46,12 @@ function xmlrpccall_simple()
             return false;
         }
 
-        $xmlrpcval_array = array();
+        $valueArray = array();
+        $encoder = new PhpXmlRpc\Encoder();
         foreach ($varargs as $parameter) {
-            $xmlrpcval_array[] = php_xmlrpc_encode($parameter);
+            $valueArray[] = $encoder->encode($parameter);
         }
 
-        return $client->send(new xmlrpcmsg($remote_function_name, $xmlrpcval_array));
+        return $client->send(new PhpXmlRpc\Request($remote_function_name, $valueArray));
     }
 }