Documentation

xmlrpc_client
in package

Table of Contents

Properties

$accepted_charset_encodings  : mixed
$accepted_compression  : mixed
List of http compression methods accepted by the client for responses.
$authtype  : mixed
$cacert  : mixed
$cacertdir  : mixed
$cert  : mixed
$certpass  : mixed
$cookies  : mixed
$debug  : mixed
$errno  : mixed
$errstr  : mixed
$keepalive  : mixed
$key  : mixed
$keypass  : mixed
$method  : mixed
$no_multicall  : mixed
$password  : mixed
$path  : mixed
$port  : mixed
$proxy  : mixed
$proxy_authtype  : mixed
$proxy_pass  : mixed
$proxy_user  : mixed
$proxyport  : mixed
$request_charset_encoding  : mixed
$request_compression  : mixed
Name of compression scheme to be used for sending requests.
$return_type  : mixed
Decides the content of xmlrpcresp objects returned by calls to send() valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
$server  : mixed
$username  : mixed
$verifyhost  : mixed
$verifypeer  : mixed
$xmlrpc_curl_handle  : mixed
CURL handle: used for keep-alive connections (PHP 4.3.8 up, see: http://curl.haxx.se/docs/faq.html#7.3)

Methods

__construct()  : mixed
_try_multicall()  : mixed
Attempt to boxcar $msgs via system.multicall.
multicall()  : array<string|int, mixed>
Send an array of request messages and return an array of responses.
send()  : xmlrpcresp
Send an xmlrpc request
sendPayloadCURL()  : mixed
Contributed by Justin Miller <justin@voxel.net> Requires curl to be built into PHP NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
sendPayloadHTTP10()  : mixed
sendPayloadHTTPS()  : mixed
setAcceptedCompression()  : mixed
Enables/disables reception of compressed xmlrpc responses.
setCaCertificate()  : mixed
Add a CA certificate to verify server with (see man page about CURLOPT_CAINFO for more details
setCertificate()  : mixed
Add a client-side https certificate
setCookie()  : mixed
Adds a cookie to list of cookies that will be sent to server.
setCredentials()  : mixed
Add some http BASIC AUTH credentials, used by the client to authenticate
setDebug()  : mixed
Enables/disables the echoing to screen of the xmlrpc responses received
setKey()  : mixed
Set attributes for SSL communication: private SSL key
setProxy()  : mixed
Set proxy info
setRequestCompression()  : mixed
Enables/disables http compression of xmlrpc request.
setSSLVerifyHost()  : mixed
Set attributes for SSL communication: verify match of server cert w. hostname
setSSLVerifyPeer()  : mixed
Set attributes for SSL communication: verify server certificate

Properties

$accepted_charset_encodings

public mixed $accepted_charset_encodings = array()

$accepted_compression

List of http compression methods accepted by the client for responses.

public mixed $accepted_compression = array()

NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib

NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since in those cases it will be up to CURL to decide the compression methods it supports. You might check for the presence of 'zlib' in the output of curl_version() to determine wheter compression is supported or not

$authtype

public mixed $authtype = 1

$cacert

public mixed $cacert = ''

$cacertdir

public mixed $cacertdir = ''

$certpass

public mixed $certpass = ''

$cookies

public mixed $cookies = array()

$keepalive

public mixed $keepalive = \false

$keypass

public mixed $keypass = ''

$method

public mixed $method = 'http'

$no_multicall

public mixed $no_multicall = \false

$password

public mixed $password = ''

$proxy

public mixed $proxy = ''

$proxy_authtype

public mixed $proxy_authtype = 1

$proxy_pass

public mixed $proxy_pass = ''

$proxy_user

public mixed $proxy_user = ''

$proxyport

public mixed $proxyport = 0

$request_charset_encoding

public mixed $request_charset_encoding = ''

$request_compression

Name of compression scheme to be used for sending requests.

public mixed $request_compression = ''

Either null, gzip or deflate

$return_type

Decides the content of xmlrpcresp objects returned by calls to send() valid strings are 'xmlrpcvals', 'phpvals' or 'xml'

public mixed $return_type = 'xmlrpcvals'

$username

public mixed $username = ''

$verifyhost

public mixed $verifyhost = 1

$verifypeer

public mixed $verifypeer = \true

$xmlrpc_curl_handle

CURL handle: used for keep-alive connections (PHP 4.3.8 up, see: http://curl.haxx.se/docs/faq.html#7.3)

public mixed $xmlrpc_curl_handle = \null

Methods

__construct()

public __construct(string $path[, string $server = '' ][, int $port = '' ][, string $method = '' ]) : mixed
Parameters
$path : string

either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php

$server : string = ''

the server name / ip address

$port : int = ''

the port the server is listening on, defaults to 80 or 443 depending on protocol used

$method : string = ''

the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed

_try_multicall()

Attempt to boxcar $msgs via system.multicall.

public _try_multicall(mixed $msgs, mixed $timeout, mixed $method) : mixed

Returns either an array of xmlrpcreponses, an xmlrpc error response or false (when received response does not respect valid multicall syntax)

Parameters
$msgs : mixed
$timeout : mixed
$method : mixed
Tags
access

private

multicall()

Send an array of request messages and return an array of responses.

public multicall(array<string|int, mixed> $msgs[, int $timeout = 0 ][, string $method = '' ][, mixed $fallback = true ]) : array<string|int, mixed>

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 fallback to using many single calls, set the fourth parameter to FALSE.

NB: trying to shoehorn extra functionality into existing syntax has resulted in pretty much convoluted code...

Parameters
$msgs : array<string|int, mixed>

an array of xmlrpcmsg objects

$timeout : int = 0

connection timeout (in seconds)

$method : string = ''

the http protocol variant to be used

$fallback : mixed = true
Tags
access

public

Return values
array<string|int, mixed>

send()

Send an xmlrpc request

public & send(mixed $msg[, int $timeout = 0 ][, string $method = '' ]) : xmlrpcresp
Parameters
$msg : mixed

The message object, or an array of messages for using multicall, or the complete xml representation of a request

$timeout : int = 0

Connection timeout, in seconds, If unspecified, a platform specific timeout will apply

$method : string = ''

if left unspecified, the http protocol chosen during creation of the object will be used

Tags
access

public

Return values
xmlrpcresp

sendPayloadCURL()

Contributed by Justin Miller <justin@voxel.net> Requires curl to be built into PHP NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!

public & sendPayloadCURL(mixed $msg, mixed $server, mixed $port[, mixed $timeout = 0 ][, mixed $username = '' ][, mixed $password = '' ][, mixed $authtype = 1 ][, mixed $cert = '' ][, mixed $certpass = '' ][, mixed $cacert = '' ][, mixed $cacertdir = '' ][, mixed $proxyhost = '' ][, mixed $proxyport = 0 ][, mixed $proxyusername = '' ][, mixed $proxypassword = '' ][, mixed $proxyauthtype = 1 ][, mixed $method = 'https' ][, mixed $keepalive = false ][, mixed $key = '' ][, mixed $keypass = '' ]) : mixed
Parameters
$msg : mixed
$server : mixed
$port : mixed
$timeout : mixed = 0
$username : mixed = ''
$password : mixed = ''
$authtype : mixed = 1
$cert : mixed = ''
$certpass : mixed = ''
$cacert : mixed = ''
$cacertdir : mixed = ''
$proxyhost : mixed = ''
$proxyport : mixed = 0
$proxyusername : mixed = ''
$proxypassword : mixed = ''
$proxyauthtype : mixed = 1
$method : mixed = 'https'
$keepalive : mixed = false
$key : mixed = ''
$keypass : mixed = ''
Tags
access

private

sendPayloadHTTP10()

public & sendPayloadHTTP10(mixed $msg, mixed $server, mixed $port[, mixed $timeout = 0 ][, mixed $username = '' ][, mixed $password = '' ][, mixed $authtype = 1 ][, mixed $proxyhost = '' ][, mixed $proxyport = 0 ][, mixed $proxyusername = '' ][, mixed $proxypassword = '' ][, mixed $proxyauthtype = 1 ]) : mixed
Parameters
$msg : mixed
$server : mixed
$port : mixed
$timeout : mixed = 0
$username : mixed = ''
$password : mixed = ''
$authtype : mixed = 1
$proxyhost : mixed = ''
$proxyport : mixed = 0
$proxyusername : mixed = ''
$proxypassword : mixed = ''
$proxyauthtype : mixed = 1
Tags
access

private

sendPayloadHTTPS()

public & sendPayloadHTTPS(mixed $msg, mixed $server, mixed $port[, mixed $timeout = 0 ][, mixed $username = '' ][, mixed $password = '' ][, mixed $authtype = 1 ][, mixed $cert = '' ][, mixed $certpass = '' ][, mixed $cacert = '' ][, mixed $cacertdir = '' ][, mixed $proxyhost = '' ][, mixed $proxyport = 0 ][, mixed $proxyusername = '' ][, mixed $proxypassword = '' ][, mixed $proxyauthtype = 1 ][, mixed $keepalive = false ][, mixed $key = '' ][, mixed $keypass = '' ]) : mixed
Parameters
$msg : mixed
$server : mixed
$port : mixed
$timeout : mixed = 0
$username : mixed = ''
$password : mixed = ''
$authtype : mixed = 1
$cert : mixed = ''
$certpass : mixed = ''
$cacert : mixed = ''
$cacertdir : mixed = ''
$proxyhost : mixed = ''
$proxyport : mixed = 0
$proxyusername : mixed = ''
$proxypassword : mixed = ''
$proxyauthtype : mixed = 1
$keepalive : mixed = false
$key : mixed = ''
$keypass : mixed = ''
Tags
access

private

setAcceptedCompression()

Enables/disables reception of compressed xmlrpc responses.

public setAcceptedCompression(string $compmethod) : mixed

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
$compmethod : string

either 'gzip', 'deflate', 'any' or ''

Tags
access

public

setCaCertificate()

Add a CA certificate to verify server with (see man page about CURLOPT_CAINFO for more details

public setCaCertificate(string $cacert[, bool $is_dir = false ]) : mixed
Parameters
$cacert : string

certificate file name (or dir holding certificates)

$is_dir : bool = false

set to true to indicate cacert is a dir. defaults to false

Tags
access

public

setCertificate()

Add a client-side https certificate

public setCertificate(string $cert, string $certpass) : mixed
Parameters
$cert : string
$certpass : string
Tags
access

public

setCookie()

Adds a cookie to list of cookies that will be sent to server.

public setCookie(string $name[, string $value = '' ][, string $path = '' ][, string $domain = '' ][, int $port = null ]) : mixed

NB: setting any param but name and value will turn the cookie into a 'version 1' cookie: do not do it unless you know what you are doing

Parameters
$name : string
$value : string = ''
$path : string = ''
$domain : string = ''
$port : int = null
Tags
access

public

todo

check correctness of urlencoding cookie value (copied from php way of doing it...)

setCredentials()

Add some http BASIC AUTH credentials, used by the client to authenticate

public setCredentials(string $u, string $p[, int $t = 1 ]) : mixed
Parameters
$u : string

username

$p : string

password

$t : int = 1

auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)

Tags
access

public

setDebug()

Enables/disables the echoing to screen of the xmlrpc responses received

public setDebug(mixed $in) : mixed
Parameters
$in : mixed
Tags
access

public

setKey()

Set attributes for SSL communication: private SSL key

public setKey(string $key, string $keypass) : mixed
Parameters
$key : string

The name of a file containing a private SSL key

$keypass : string

The secret password needed to use the private SSL key

Tags
access

public NB: does not work in older php/curl installs Thanks to Daniel Convissor

setProxy()

Set proxy info

public setProxy(string $proxyhost, string $proxyport[, string $proxyusername = '' ][, string $proxypassword = '' ][, int $proxyauthtype = 1 ]) : mixed
Parameters
$proxyhost : string
$proxyport : string

Defaults to 8080 for HTTP and 443 for HTTPS

$proxyusername : string = ''

Leave blank if proxy has public access

$proxypassword : string = ''

Leave blank if proxy has public access

$proxyauthtype : int = 1

set to constant CURLAUTH_NTLM to use NTLM auth with proxy

Tags
access

public

setRequestCompression()

Enables/disables http compression of xmlrpc request.

public setRequestCompression(string $compmethod) : mixed

Take care when sending compressed requests: servers might not support them (and automatic fallback to uncompressed requests is not yet implemented)

Parameters
$compmethod : string

either 'gzip', 'deflate' or ''

Tags
access

public

setSSLVerifyHost()

Set attributes for SSL communication: verify match of server cert w. hostname

public setSSLVerifyHost(int $i) : mixed
Parameters
$i : int
Tags
access

public

setSSLVerifyPeer()

Set attributes for SSL communication: verify server certificate

public setSSLVerifyPeer(bool $i) : mixed
Parameters
$i : bool

enable/disable verification of peer certificate

Tags
access

public


        
On this page

Search results