2 /***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once 'platal/xmlrpc-server.inc.php';
24 /* taken from : http://fr2.php.net/xml-rpc
25 * Author mboeren@php.net
28 * $client = new xmlrpc_client("http://localhost:7080");
29 * print $client->echo('x')."\n";
30 * print $client->add(1, 3)."\n";
38 function xmlrpc_client($url)
41 $this->urlparts
= parse_url($this->url
);
42 foreach (array('scheme', 'host', 'user', 'pass', 'path', 'query', 'fragment') as $part) {
43 if (!isset($this->urlparts
[$part])) {
44 $this->urlparts
[$part] = null
;
49 function __call($function, $arguments, &$return)
51 $requestprms['host'] = $this->urlparts
['host'];
52 $requestprms['port'] = $this->urlparts
['port'];
53 $requestprms['uri'] = $this->urlparts
['path'];
54 $requestprms['user'] = $this->urlparts
['user'];
55 $requestprms['pass'] = $this->urlparts
['pass'];
56 $requestprms['method'] = $function;
57 $requestprms['args'] = $arguments;
58 $requestprms['timeout'] = 0;
59 $requestprms['secure'] = 0;
61 $result = xu_rpc_http_concise($requestprms);
62 if (is_array($result) && isset($result['faultCode'])) {
63 print('Error in xmlrpc call \''.$function.'\''."\n");
64 print(' code : '.$result['faultCode']."\n");
65 print(' message: '.$result['faultString']."\n");
74 overload('xmlrpc_client');
76 // vim:set et sw=4 sts=4 sws=4: