?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>XMLRPC Debugger</title>
<meta name="robots" content="index,nofollow"/>
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>XMLRPC Debugger</title>
<meta name="robots" content="index,nofollow"/>
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html>
+<html lang="en">
<head>
<title>XMLRPC Debugger</title>
</head>
--- /dev/null
+<?php
+/**
+ * Hackish code used to make the demos both viewable as source, runnable, and viewable as html
+ */
+
+// Make errors visible
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+
+if (isset($_GET['showSource']) && $_GET['showSource']) {
+ $file = debug_backtrace()[0]['file'];
+ highlight_file($file);
+ die();
+}
+
+// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
+include_once __DIR__ . '/../../src/Autoloader.php';
+PhpXmlRpc\Autoloader::register();
+
+// Let unit tests run against localhost, 'plain' demos against a known public server
+if (isset($_SERVER['LOCALSERVER'])) {
+ define('XMLRPCSERVER', 'http://'.$_SERVER['LOCALSERVER'].'/demo/server/server.php');
+} else {
+ define('XMLRPCSERVER', 'http://phpxmlrpc.sourceforge.net/server.php');
+}
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Agesort demo</title></head>
<body>
<h1>Agesort demo</h1>
<h3>The source code demonstrates basic lib usage, including handling of xmlrpc arrays and structs</h3>
-<p></p>
+<p>You can see the source to this page here: <a href="agesort.php?showSource=1">agesort.php</a></p>
<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
$inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
print "This is the input data:<br/><pre>";
foreach ($inAr as $key => $val) {
}
print "</pre>";
-// 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(
// 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);
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Getstatename demo</title></head>
<body>
<h1>Getstatename demo</h1>
<h2>Send a U.S. state number to the server and get back the state name</h2>
<h3>The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values</h3>
-<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
+<p>You can see the source to this page here: <a href="getstatename.php?showSource=1">getstatename.php</a></p>
+<?php
if (isset($_POST["stateno"]) && $_POST["stateno"] != "") {
$stateNo = (integer)$_POST["stateno"];
array($encoder->encode($stateNo))
);
print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug 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 "<br/>State number <b>" . $stateNo . "</b> is <b>"
- . htmlspecialchars($encoder->decode($v)) . "</b><br/>";
+ . htmlspecialchars($encoder->decode($v)) . "</b><br/><br/>";
} else {
print "An error occurred: ";
print "Code: " . htmlspecialchars($r->faultCode())
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Introspect demo</title></head>
<body>
<h1>Introspect demo</h1>
<h2>Query server for available methods and their description</h2>
<h3>The code demonstrates usage of multicall and introspection methods</h3>
+<p>You can see the source to this page here: <a href="introspect.php?showSource=1">introspect.php</a></p>
<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
function display_error($r)
{
print "An error occurred: ";
. " Reason: '" . $r->faultString() . "'<br/>";
}
-$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$client = new PhpXmlRpc\Client(XMLRPCSERVER);
// First off, let's retrieve the list of methods available on the remote server
print "<h3>methods available at http://" . $client->server . $client->path . "</h3>\n";
-<?php
-// Allow users to see the source of this file even if PHP is not configured for it
-if (isset($_GET['showSource']) && $_GET['showSource']) {
- highlight_file(__FILE__);
- die();
-}
-?>
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Mail demo</title></head>
<body>
<h1>Mail demo</h1>
When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC request sent to the host server, the
XML-RPC response received and the internal evaluation done by the PHP implementation.</p>
-<p>You can find the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
+<p>You can see the source to this page here: <a href="mail.php?showSource=1">mail.php</a><br/>
And the source to a functionally identical mail-by-XML-RPC server in the file <a
href="../server/server.php?showSource=1">server.php</a> included with the library (look for the 'mail_send'
method)</p>
<?php
+// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
include_once __DIR__ . "/../../src/Autoloader.php";
PhpXmlRpc\Autoloader::register();
if (isset($_POST["mailto"]) && $_POST["mailto"]) {
- $server = "http://phpxmlrpc.sourceforge.net/server.php";
+ $server = XMLRPCSERVER;
$req = new PhpXmlRpc\Request('mail.send', array(
new PhpXmlRpc\Value($_POST["mailto"]),
new PhpXmlRpc\Value($_POST["mailsub"]),
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Proxy demo</title></head>
<body>
<h1>proxy demo</h1>
<h2>Query server using a 'proxy' object</h2>
<h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3>
+<p>You can see the source to this page here: <a href="proxy.php?showSource=1">proxy.php</a></p>
<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
class PhpXmlRpcProxy
{
protected $client;
return $resp->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);
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Which toolkit demo</title></head>
<body>
<h1>Which toolkit demo</h1>
<h2>Query server for toolkit information</h2>
<h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3>
+<p>You can see the source to this page here: <a href="which.php?showSource=1">which.php</a></p>
<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
$req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
-$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$client = new PhpXmlRpc\Client(XMLRPCSERVER);
$resp = $client->send($req);
if (!$resp->faultCode()) {
$encoder = new PhpXmlRpc\Encoder();
$value = $encoder->decode($resp->value());
+ print "Toolkit info:<br/>\n";
print "<pre>";
print "name: " . htmlspecialchars($value["toolkitName"]) . "\n";
print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n";
-<html>
+<?php require_once __DIR__ . "/_bootstrap.php"; ?><html lang="en">
<head><title>xmlrpc - Webservice wrappper demo</title></head>
<body>
<h1>Webservice wrappper demo</h1>
2) wrapping of remote methods into php functions<br/>
See also proxy.php for an alternative take
</h3>
+<p>You can see the source to this page here: <a href="wrap.php?showSource=1">wrap.php</a></p>
<?php
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
-$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$client = new PhpXmlRpc\Client(XMLRPCSERVER);
$client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
$resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
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);
}
}
?>
--- /dev/null
+<?php
+/**
+ * Hackish code used to make the demos both viewable as source, runnable, and viewable as html
+ */
+
+// Make errors visible
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+
+if (isset($_GET['showSource']) && $_GET['showSource']) {
+ $file = debug_backtrace()[0]['file'];
+ highlight_file($file);
+ die();
+}
+
+// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
+include_once __DIR__ . '/../../src/Autoloader.php';
+PhpXmlRpc\Autoloader::register();
<?php
-include_once __DIR__ . "/../../vendor/autoload.php";
+require_once __DIR__ . "/_bootstrap.php";
use PhpXmlRpc\Value;
* @license code licensed under the BSD License: see file license.txt
*/
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
+require_once __DIR__ . "/_bootstrap.php";
/**
* Forward an xmlrpc request to another server, and return to client the response received.
// build call for remote server
/// @todo find a way to forward client info (such as IP) to server, either
- /// - as xml comments in the payload, or
- /// - using std http header conventions, such as X-forwarded-for...
+ /// - as xml comments in the payload, or
+ /// - using std http header conventions, such as X-forwarded-for...
$reqMethod = $encoder->decode($req->getParam(1));
$pars = $req->getParam(2);
$req = new PhpXmlRpc\Request($reqMethod);
* 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!
include_once __DIR__ . '/PolyfillTestCase.php';
-use PHPUnit\Framework\TestResult;
-
abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
{
public $args = array();
* @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
$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__,
);
$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