From f1e595deaca76bd28257adb82916624ac59eb5b1 Mon Sep 17 00:00:00 2001
From: gggeek You can see the source to this page here: agesort.phpAgesort demo
@@ -7,12 +7,9 @@
The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs
-
+";
foreach ($inAr as $key => $val) {
@@ -20,7 +17,7 @@ foreach ($inAr as $key => $val) {
}
print "
";
-// create parameters from the input array: an xmlrpc array of xmlrpc structs
+// Create parameters from the input array: an xmlrpc array of xmlrpc structs
$p = array();
foreach ($inAr as $key => $val) {
$p[] = new PhpXmlRpc\Value(
@@ -36,7 +33,7 @@ print "Encoded into xmlrpc format it looks like this: \n" . htmlentities($v
// create client and message objects
$req = new PhpXmlRpc\Request('examples.sortByAge', array($v));
-$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$client = new PhpXmlRpc\Client(XMLRPCSERVER);
// set maximum debug level, to have the complete communication printed to screen
$client->setDebug(2);
diff --git a/demo/client/getstatename.php b/demo/client/getstatename.php
index 69ce3e0f..304bf258 100644
--- a/demo/client/getstatename.php
+++ b/demo/client/getstatename.php
@@ -1,4 +1,4 @@
-
+
Getstatename demo
@@ -6,10 +6,9 @@
Send a U.S. state number to the server and get back the state name
The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values
-You can see the source to this page here: getstatename.php
\n\n" . htmlentities($req->serialize()) . "\n\nDebug info of server data follows...\n\n"; - $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); + $client = new PhpXmlRpc\Client(XMLRPCSERVER); $client->setDebug(1); $r = $client->send($req); if (!$r->faultCode()) { $v = $r->value(); print "
You can see the source to this page here: introspect.php
faultString() . "'You can find the source to this page here: mail.php
+
You can see the source to this page here: mail.php
And the source to a functionally identical mail-by-XML-RPC server in the file server.php included with the library (look for the 'mail_send'
method)
You can see the source to this page here: proxy.php
value(); } } - } $stateNo = rand(1, 51); -$proxy = new PhpXmlRpcProxy(new \PhpXmlRpc\Client('http://phpxmlrpc.sourceforge.net/server.php')); +$proxy = new PhpXmlRpcProxy(new \PhpXmlRpc\Client(XMLRPCSERVER)); $stateName = $proxy->getStateName($stateNo); echo "State $stateNo is ".htmlspecialchars($stateName); diff --git a/demo/client/which.php b/demo/client/which.php index 5d332159..6664e2f0 100644 --- a/demo/client/which.php +++ b/demo/client/which.php @@ -1,20 +1,19 @@ - +You can see the source to this page here: which.php
send($req); if (!$resp->faultCode()) { $encoder = new PhpXmlRpc\Encoder(); $value = $encoder->decode($resp->value()); + print "Toolkit info:"; print "name: " . htmlspecialchars($value["toolkitName"]) . "\n"; print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"; diff --git a/demo/client/wrap.php b/demo/client/wrap.php index c13c55d3..88d6a8d2 100644 --- a/demo/client/wrap.php +++ b/demo/client/wrap.php @@ -1,4 +1,4 @@ - +xmlrpc - Webservice wrappper demo Webservice wrappper demo
@@ -10,12 +10,10 @@ 2) wrapping of remote methods into php functions
See also proxy.php for an alternative take +You can see the source to this page here: wrap.php
return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); if ($resp->faultCode()) { @@ -44,8 +42,9 @@ if ($resp->faultCode()) { if ($callable) { echo "Now testing function for remote method to convert U.S. state number into state name"; $stateNum = rand(1, 51); - // the 2nd parameter gets added to the closure - it is teh debug level to be used for the client + // the 2nd parameter gets added to the closure - it is the debug level to be used for the client $stateName = $callable($stateNum, 2); + echo "State $stateNum is ".htmlspecialchars($stateName); } } ?> diff --git a/demo/server/_bootstrap.php b/demo/server/_bootstrap.php new file mode 100644 index 00000000..b16296e9 --- /dev/null +++ b/demo/server/_bootstrap.php @@ -0,0 +1,18 @@ +decode($req->getParam(1)); $pars = $req->getParam(2); $req = new PhpXmlRpc\Request($reqMethod); diff --git a/demo/server/server.php b/demo/server/server.php index d8366749..6e9fdf96 100644 --- a/demo/server/server.php +++ b/demo/server/server.php @@ -9,13 +9,7 @@ * Please do not copy this file verbatim into your production server. **/ -// give user a chance to see the source for this server instead of running the services -if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) { - highlight_file(__FILE__); - die(); -} - -include_once __DIR__ . "/../../vendor/autoload.php"; +require_once __DIR__ . "/_bootstrap.php"; // out-of-band information: let the client manipulate the server operations. // we do this to help the testsuite script: do not reproduce in production! diff --git a/tests/LocalFileTestCase.php b/tests/LocalFileTestCase.php index 6ec48b32..13160c71 100644 --- a/tests/LocalFileTestCase.php +++ b/tests/LocalFileTestCase.php @@ -4,8 +4,6 @@ include_once __DIR__ . '/parse_args.php'; include_once __DIR__ . '/PolyfillTestCase.php'; -use PHPUnit\Framework\TestResult; - abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase { public $args = array(); diff --git a/tests/parse_args.php b/tests/parse_args.php index 4ef568d3..f9c45629 100644 --- a/tests/parse_args.php +++ b/tests/parse_args.php @@ -7,12 +7,11 @@ * @param string LOCALSERVER * @param string URI * @param string HTTPSSERVER - * @param string HTTPSSURI - * @param string PROXY - * @param string NOPROXY + * @param string HTTPSURI * @param bool HTTPSIGNOREPEER * @param int HTTPSVERIFYHOST * @param int SSLVERSION + * @param string PROXYSERVER * * @copyright (C) 2007-2020 G. Giunta * @license code licensed under the BSD License: see file license.txt @@ -24,13 +23,12 @@ class argParser $args = array( 'DEBUG' => 0, 'LOCALSERVER' => 'localhost', - 'HTTPSSERVER' => 'gggeek.ssl.altervista.org', + 'HTTPSSERVER' => 'gggeek.altervista.org', 'HTTPSURI' => '/sw/xmlrpc/demo/server/server.php', 'HTTPSIGNOREPEER' => false, 'HTTPSVERIFYHOST' => 2, 'SSLVERSION' => 0, 'PROXYSERVER' => null, - //'NOPROXY' => false, 'LOCALPATH' => __DIR__, ); @@ -83,10 +81,6 @@ class argParser $args['PROXYPORT'] = 8080; } } - // used to silence testsuite warnings about proxy code not being tested - //if (isset($NOPROXY)) { - // $args['NOPROXY'] = true; - //} if (!isset($URI)) { // GUESTIMATE the url of local demo server // play nice to php 3 and 4-5 in retrieving URL of server.php -- 2.47.0