note 40176 added to ref.xmlrpc

From: Date: Tue, 24 Feb 2004 12:01:12 +0000
Subject: note 40176 added to ref.xmlrpc
Groups: php.notes 
Request: Send a blank email to php-notes+get-65645@lists.php.net to get a copy of this message
I use the following code (requires the overload extension) to make developing clients easier: <?php include("utils/utils.php"); // from xmlrpc-epi utils /* Usage: $client = new xmlrpc_client("http://localhost:7080"); print $client->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'); ?> ---- Manual Page -- http://www.php.net/manual/en/ref.xmlrpc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40176 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40176&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40176&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65645) next »