Cheetah
Public Member Functions | Public Attributes | List of all members
xmlrpc_client Class Reference

Public Member Functions

 __construct ($path, $server='', $port='', $method='')
 
 setDebug ($in)
 
 setCredentials ($u, $p, $t=1)
 
 setCertificate ($cert, $certpass)
 
 setCaCertificate ($cacert, $is_dir=false)
 
 setKey ($key, $keypass)
 
 setSSLVerifyPeer ($i)
 
 setSSLVerifyHost ($i)
 
 setProxy ($proxyhost, $proxyport, $proxyusername='', $proxypassword='', $proxyauthtype=1)
 
 setAcceptedCompression ($compmethod)
 
 setRequestCompression ($compmethod)
 
 setCookie ($name, $value='', $path='', $domain='', $port=null)
 
send ($msg, $timeout=0, $method='')
 
sendPayloadHTTP10 ($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)
 
sendPayloadHTTPS ($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='', $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $keepalive=false, $key='', $keypass='')
 
sendPayloadCURL ($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='', $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https', $keepalive=false, $key='', $keypass='')
 
 multicall ($msgs, $timeout=0, $method='', $fallback=true)
 
 _try_multicall ($msgs, $timeout, $method)
 

Public Attributes

 $path
 
 $server
 
 $port =0
 
 $method ='http'
 
 $errno
 
 $errstr
 
 $debug =0
 
 $username =''
 
 $password =''
 
 $authtype =1
 
 $cert =''
 
 $certpass =''
 
 $cacert =''
 
 $cacertdir =''
 
 $key =''
 
 $keypass =''
 
 $verifypeer =true
 
 $verifyhost =1
 
 $no_multicall =false
 
 $proxy =''
 
 $proxyport =0
 
 $proxy_user =''
 
 $proxy_pass =''
 
 $proxy_authtype =1
 
 $cookies =array()
 
 $accepted_compression = array()
 
 $request_compression = ''
 
 $xmlrpc_curl_handle = null
 
 $keepalive = false
 Wheter to use persistent connections for http 1.1 and https. More...
 
 $accepted_charset_encodings = array()
 Charset encodings that can be decoded without problems by the client. More...
 
 $request_charset_encoding = ''
 Charset encoding to be used in serializing request. NULL = use ASCII. More...
 
 $return_type = 'xmlrpcvals'
 

Detailed Description

Definition at line 820 of file xmlrpc.inc.

Constructor & Destructor Documentation

◆ __construct()

xmlrpc_client::__construct (   $path,
  $server = '',
  $port = '',
  $method = '' 
)
Parameters
string$patheither the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
string$serverthe server name / ip address
integer$portthe port the server is listening on, defaults to 80 or 443 depending on protocol used
string$methodthe http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed

Definition at line 885 of file xmlrpc.inc.

Member Function Documentation

◆ _try_multicall()

xmlrpc_client::_try_multicall (   $msgs,
  $timeout,
  $method 
)

Attempt to boxcar $msgs via system.multicall. Returns either an array of xmlrpcreponses, an xmlrpc error response or false (when received response does not respect valid multicall syntax) @access private

Definition at line 1775 of file xmlrpc.inc.

◆ multicall()

xmlrpc_client::multicall (   $msgs,
  $timeout = 0,
  $method = '',
  $fallback = true 
)

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 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
array$msgsan array of xmlrpcmsg objects
integer$timeoutconnection timeout (in seconds)
string$methodthe http protocol variant to be used
booleanfallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
Returns
array @access public

Definition at line 1703 of file xmlrpc.inc.

◆ send()

& xmlrpc_client::send (   $msg,
  $timeout = 0,
  $method = '' 
)

Send an xmlrpc request

Parameters
mixed$msgThe message object, or an array of messages for using multicall, or the complete xml representation of a request
integer$timeoutConnection timeout, in seconds, If unspecified, a platform specific timeout will apply
string$methodif left unspecified, the http protocol chosen during creation of the object will be used
Returns
xmlrpcresp @access public

Definition at line 1128 of file xmlrpc.inc.

◆ sendPayloadCURL()

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

Contributed by Justin Miller justi.nosp@m.n@vo.nosp@m.xel.n.nosp@m.et Requires curl to be built into PHP NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers! @access private

Definition at line 1425 of file xmlrpc.inc.

◆ sendPayloadHTTP10()

& xmlrpc_client::sendPayloadHTTP10 (   $msg,
  $server,
  $port,
  $timeout = 0,
  $username = '',
  $password = '',
  $authtype = 1,
  $proxyhost = '',
  $proxyport = 0,
  $proxyusername = '',
  $proxypassword = '',
  $proxyauthtype = 1 
)

@access private

Definition at line 1224 of file xmlrpc.inc.

◆ sendPayloadHTTPS()

& xmlrpc_client::sendPayloadHTTPS (   $msg,
  $server,
  $port,
  $timeout = 0,
  $username = '',
  $password = '',
  $authtype = 1,
  $cert = '',
  $certpass = '',
  $cacert = '',
  $cacertdir = '',
  $proxyhost = '',
  $proxyport = 0,
  $proxyusername = '',
  $proxypassword = '',
  $proxyauthtype = 1,
  $keepalive = false,
  $key = '',
  $keypass = '' 
)

@access private

Definition at line 1408 of file xmlrpc.inc.

◆ setAcceptedCompression()

xmlrpc_client::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
string$compmethodeither 'gzip', 'deflate', 'any' or '' @access public

Definition at line 1071 of file xmlrpc.inc.

◆ setCaCertificate()

xmlrpc_client::setCaCertificate (   $cacert,
  $is_dir = false 
)

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

Parameters
string$cacertcertificate file name (or dir holding certificates)
bool$is_dirset to true to indicate cacert is a dir. defaults to false @access public

Definition at line 999 of file xmlrpc.inc.

◆ setCertificate()

xmlrpc_client::setCertificate (   $cert,
  $certpass 
)

Add a client-side https certificate

Parameters
string$cert
string$certpass@access public

Definition at line 986 of file xmlrpc.inc.

◆ setCookie()

xmlrpc_client::setCookie (   $name,
  $value = '',
  $path = '',
  $domain = '',
  $port = null 
)

Adds a cookie to list of cookies that will be sent to server. 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
string$name
string$value
string$path
string$domain
int$port@access public

Definition at line 1104 of file xmlrpc.inc.

◆ setCredentials()

xmlrpc_client::setCredentials (   $u,
  $p,
  $t = 1 
)

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

Parameters
string$uusername
string$ppassword
integer$tauth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth) @access public

Definition at line 973 of file xmlrpc.inc.

◆ setDebug()

xmlrpc_client::setDebug (   $in)

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

Parameters
integer$debugvalues 0, 1 and 2 are supported (2 = echo sent msg too, before received response) @access public

Definition at line 961 of file xmlrpc.inc.

◆ setKey()

xmlrpc_client::setKey (   $key,
  $keypass 
)

Set attributes for SSL communication: private SSL key NB: does not work in older php/curl installs Thanks to Daniel Convissor

Parameters
string$keyThe name of a file containing a private SSL key
string$keypassThe secret password needed to use the private SSL key @access public

Definition at line 1019 of file xmlrpc.inc.

◆ setProxy()

xmlrpc_client::setProxy (   $proxyhost,
  $proxyport,
  $proxyusername = '',
  $proxypassword = '',
  $proxyauthtype = 1 
)

Set proxy info

Parameters
string$proxyhost
string$proxyportDefaults to 8080 for HTTP and 443 for HTTPS
string$proxyusernameLeave blank if proxy has public access
string$proxypasswordLeave blank if proxy has public access
int$proxyauthtypeset to constant CURLAUTH_NTLM to use NTLM auth with proxy @access public

Definition at line 1054 of file xmlrpc.inc.

◆ setRequestCompression()

xmlrpc_client::setRequestCompression (   $compmethod)

Enables/disables http compression of xmlrpc request. Take care when sending compressed requests: servers might not support them (and automatic fallback to uncompressed requests is not yet implemented)

Parameters
string$compmethodeither 'gzip', 'deflate' or '' @access public

Definition at line 1086 of file xmlrpc.inc.

◆ setSSLVerifyHost()

xmlrpc_client::setSSLVerifyHost (   $i)

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

Parameters
int$i@access public

Definition at line 1040 of file xmlrpc.inc.

◆ setSSLVerifyPeer()

xmlrpc_client::setSSLVerifyPeer (   $i)

Set attributes for SSL communication: verify server certificate

Parameters
bool$ienable/disable verification of peer certificate @access public

Definition at line 1030 of file xmlrpc.inc.

Member Data Documentation

◆ $accepted_charset_encodings

xmlrpc_client::$accepted_charset_encodings = array()

Charset encodings that can be decoded without problems by the client.

Definition at line 870 of file xmlrpc.inc.

◆ $accepted_compression

xmlrpc_client::$accepted_compression = array()

List of http compression methods accepted by the client for responses. 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

Definition at line 856 of file xmlrpc.inc.

◆ $authtype

xmlrpc_client::$authtype =1

Definition at line 831 of file xmlrpc.inc.

◆ $cacert

xmlrpc_client::$cacert =''

Definition at line 834 of file xmlrpc.inc.

◆ $cacertdir

xmlrpc_client::$cacertdir =''

Definition at line 835 of file xmlrpc.inc.

◆ $cert

xmlrpc_client::$cert =''

Definition at line 832 of file xmlrpc.inc.

◆ $certpass

xmlrpc_client::$certpass =''

Definition at line 833 of file xmlrpc.inc.

◆ $cookies

xmlrpc_client::$cookies =array()

Definition at line 846 of file xmlrpc.inc.

◆ $debug

xmlrpc_client::$debug =0

Definition at line 828 of file xmlrpc.inc.

◆ $errno

xmlrpc_client::$errno

Definition at line 826 of file xmlrpc.inc.

◆ $errstr

xmlrpc_client::$errstr

Definition at line 827 of file xmlrpc.inc.

◆ $keepalive

xmlrpc_client::$keepalive = false

Wheter to use persistent connections for http 1.1 and https.

Definition at line 868 of file xmlrpc.inc.

◆ $key

xmlrpc_client::$key =''

Definition at line 836 of file xmlrpc.inc.

◆ $keypass

xmlrpc_client::$keypass =''

Definition at line 837 of file xmlrpc.inc.

◆ $method

xmlrpc_client::$method ='http'

Definition at line 825 of file xmlrpc.inc.

◆ $no_multicall

xmlrpc_client::$no_multicall =false

Definition at line 840 of file xmlrpc.inc.

◆ $password

xmlrpc_client::$password =''

Definition at line 830 of file xmlrpc.inc.

◆ $path

xmlrpc_client::$path

Definition at line 822 of file xmlrpc.inc.

◆ $port

xmlrpc_client::$port =0

Definition at line 824 of file xmlrpc.inc.

◆ $proxy

xmlrpc_client::$proxy =''

Definition at line 841 of file xmlrpc.inc.

◆ $proxy_authtype

xmlrpc_client::$proxy_authtype =1

Definition at line 845 of file xmlrpc.inc.

◆ $proxy_pass

xmlrpc_client::$proxy_pass =''

Definition at line 844 of file xmlrpc.inc.

◆ $proxy_user

xmlrpc_client::$proxy_user =''

Definition at line 843 of file xmlrpc.inc.

◆ $proxyport

xmlrpc_client::$proxyport =0

Definition at line 842 of file xmlrpc.inc.

◆ $request_charset_encoding

xmlrpc_client::$request_charset_encoding = ''

Charset encoding to be used in serializing request. NULL = use ASCII.

Definition at line 872 of file xmlrpc.inc.

◆ $request_compression

xmlrpc_client::$request_compression = ''

Name of compression scheme to be used for sending requests. Either null, gzip or deflate

Definition at line 861 of file xmlrpc.inc.

◆ $return_type

xmlrpc_client::$return_type = 'xmlrpcvals'

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

Definition at line 877 of file xmlrpc.inc.

◆ $server

xmlrpc_client::$server

Definition at line 823 of file xmlrpc.inc.

◆ $username

xmlrpc_client::$username =''

Definition at line 829 of file xmlrpc.inc.

◆ $verifyhost

xmlrpc_client::$verifyhost =1

Definition at line 839 of file xmlrpc.inc.

◆ $verifypeer

xmlrpc_client::$verifypeer =true

Definition at line 838 of file xmlrpc.inc.

◆ $xmlrpc_curl_handle

xmlrpc_client::$xmlrpc_curl_handle = null

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

Definition at line 866 of file xmlrpc.inc.


The documentation for this class was generated from the following file: