From f727b22d0a3b659bcc5536dbadc87cdeb3d415be Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 7 Sep 2004 20:05:17 +0000 Subject: [PATCH] a damn cool xml-rpc-client class taken from http://fr2.php.net/xml-rpc --- AUTHORS | 7 ++-- include/xml-rpc-client.inc.php | 80 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 include/xml-rpc-client.inc.php diff --git a/AUTHORS b/AUTHORS index cde6ce0..6ae2585 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,9 +6,12 @@ Polytechnique.org TEAM : Jean Sébastien Bedo Jeremy Lainé Sophie Charbonnier - Vincent Palatin + Vincent Palatin Yann Chevalier include/xml-rpc.inc.php : - Dan Libby http://xmlrpc-epi.sourceforge.net/ + Dan Libby http://xmlrpc-epi.sourceforge.net/ + +include/xml-rpc-client.inc.php: + Marc Boeren http://fr2.php.net/xml-rpc diff --git a/include/xml-rpc-client.inc.php b/include/xml-rpc-client.inc.php new file mode 100644 index 0000000..6978218 --- /dev/null +++ b/include/xml-rpc-client.inc.php @@ -0,0 +1,80 @@ +echo('x')."\n"; + * print $client->add(1, 3)."\n"; + */ + +class xmlrpc_client +{ + var $url; + var $urlparts; + + function xmlrpc_client($url) + { + $this->url = $url; + $this->urlparts = parse_url($this->url); + foreach(array('scheme', 'host', 'user', 'pass', 'path', 'query', 'fragment') as $part) { + if (!isset($this->urlparts[$part])) { + $this->urlparts[$part] = NULL; + } + } + } + + function __call($function, $arguments, &$return) + { + $requestprms['host'] = $this->urlparts['host']; + $requestprms['port'] = $this->urlparts['port']; + $requestprms['uri'] = $this->urlparts['path']; + $requestprms['method'] = $function; + $requestprms['args'] = $arguments; + $requestprms['debug'] = 0; + $requestprms['timeout'] = 0; + $requestprms['user'] = NULL; + $requestprms['pass'] = NULL; + $requestprms['secure'] = 0; + + $result = xu_rpc_http_concise($requestprms); + if (is_array($result) && isset($result['faultCode'])) { + print('Error in xmlrpc call \''.$function.'\''."\n"); + print(' code : '.$result['faultCode']."\n"); + print(' message: '.$result['faultString']."\n"); + return false; + } + $return = $result; + return true; + } + +} + +overload('xmlrpc_client'); + +// vim:set et sw=4 sts=4 sws=4: +?> -- 2.1.4