X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=demo%2Fclient%2Fwrap.php;h=d91454eb1fe3fea8d3eae0a56e2ba5aedc95a320;hb=703405e3618c751b3e9e69321e878ea9573449a4;hp=6b4e005d02a0acd84f0cc5d3b14a715d8e8be9c9;hpb=cb3966865f6e78d9ff2b4971a6c33e2e9d8613e5;p=plcapi.git
diff --git a/demo/client/wrap.php b/demo/client/wrap.php
index 6b4e005..d91454e 100644
--- a/demo/client/wrap.php
+++ b/demo/client/wrap.php
@@ -8,49 +8,49 @@
2) wrapping of remote methods into php functions
return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
- $r =& $c->send(new xmlrpcmsg('system.listMethods'));
- if($r->faultCode())
- {
- echo "
Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'
\n";
- }
- else
- {
- $testcase = '';
- echo "Server methods list retrieved, now wrapping it up...
\n\n";
- foreach($r->value() as $methodname) // $r->value is an array of strings
- {
- // do not wrap remote server system methods
- if (strpos($methodname, 'system.') !== 0)
- {
- $funcname = wrap_xmlrpc_method($c, $methodname);
- if($funcname)
- {
- echo "- Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."
\n";
- }
- else
- {
- echo "- Remote server method ".htmlspecialchars($methodname)." could not be wrapped!
\n";
- }
- if($methodname == 'examples.getStateName')
- {
- $testcase = $funcname;
- }
- }
- }
- echo "
\n";
- if($testcase)
- {
- echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
- $statenum = 25;
- $statename = $testcase($statenum, 2);
- echo "State number $statenum is ".htmlspecialchars($statename);
- }
- }
+ $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+ $c->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
+ $r =& $c->send(new xmlrpcmsg('system.listMethods'));
+ if($r->faultCode())
+ {
+ echo "Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'
\n";
+ }
+ else
+ {
+ $testcase = '';
+ echo "Server methods list retrieved, now wrapping it up...
\n\n";
+ foreach($r->value() as $methodname) // $r->value is an array of strings
+ {
+ // do not wrap remote server system methods
+ if (strpos($methodname, 'system.') !== 0)
+ {
+ $funcname = wrap_xmlrpc_method($c, $methodname);
+ if($funcname)
+ {
+ echo "- Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."
\n";
+ }
+ else
+ {
+ echo "- Remote server method ".htmlspecialchars($methodname)." could not be wrapped!
\n";
+ }
+ if($methodname == 'examples.getStateName')
+ {
+ $testcase = $funcname;
+ }
+ }
+ }
+ echo "
\n";
+ if($testcase)
+ {
+ echo "Now testing function $testcase: remote method to convert U.S. state number into state name";
+ $statenum = 25;
+ $statename = $testcase($statenum, 2);
+ echo "State number $statenum is ".htmlspecialchars($statename);
+ }
+ }
?>
$Id$