Class: xmlrpc_client

xmlrpc_client(path, server, port, method)

new xmlrpc_client(path, server, port, method)

Parameters:
Name Type Description
path string
server string
port int optional. Defaults to 80 for http, 443 for https
method string not in use yet. Valid values: 'https', 'http'
Source:
To Do:
  • verify support for: https, proxies, auth types, recovering cookies, ---> via getAllResponseHeaders() response/request compression, ---> response = handled transparently by the browser, request === to do charset transcoding, ---> done transparently (?) by the browser ...

Methods

multiCall(messages, timeout, method, fallback)

Send an array of request messages and return an array of responses. Unless this.no_multicall has been set to true, it will try first to use one single xmlrpc call to server method system.multicall, and revert to sending many successive calls in case of failure. This failure is also stored in this.no_multicall for subsequent calls. Unfortunately, there is no server error code universally used to denote the fact that multicall is unsupported, so there is no way to reliably distinguish between that and a temporary failure. If you are sure that server supports multicall and do not want to fall back to using many single calls, set the fourth parameter to FALSE.
Parameters:
Name Type Description
messages array an array of xmlrpcmsg objects
timeout int Not in use (yet). Connection timeout (in seconds) for every single request made
method string The http protocol variant to be used. If undefined, defaults to the variant used at obj creation time. Not in use (yet)
fallback boolean When true (the default value), upon receiving an error during multicall, multiple single calls will be attempted
Source:

send(msg, timeout, method)

Send an xmlrpc request.
Parameters:
Name Type Description
msg any The message object, or an array of messages for using multicall, or the complete xml representation of a request
timeout int Connection timeout, in seconds. If unspecified, or 0 a platform specific timeout will apply. Used only with async calls and callback faunctions.
method string | object if string: 'method' - if left unspecified, the http protocol chosen during creation of the object will be used if object: callback function that accepts an xmlrpcresp obj as parameter
Source:

setAcceptedCompression(compmethod)

Enables/disables reception of compressed xmlrpc responses. Note that enabling reception of compressed responses merely adds some standard http headers to xmlrpc requests. It is up to the xmlrpc server to return compressed responses when receiving such requests.
Parameters:
Name Type Description
compmethod string either 'gzip', 'deflate', 'any', 'auto' or ''. 'auto' means the javascript host (eg. the browser) will decide what to do
Source:

setCredentials(username, password, authtype)

Add some http BASIC AUTH credentials, used by the client to authenticate.
Parameters:
Name Type Description
username string
password string
authtype int Not in use (yet). See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
Source:

setDebug(dbg)

Enables/disables the echoing to screen of the xmlrpc responses received.
Parameters:
Name Type Description
dbg int values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
Source:

setUserAgent(agentstring)

Set user-agent string that will be used by this client instance in http headers sent to the server.
Parameters:
Name Type Description
agentstring string
Source: