[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/phpxmlrpc/ -> xmlrpc.php (summary)

(no description)

File Size: 3640 lines (110 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

xmlrpc_client:: (17 methods):
  xmlrpc_client()
  setDebug()
  setCredentials()
  setCertificate()
  setCaCertificate()
  setKey()
  setSSLVerifyPeer()
  setSSLVerifyHost()
  setProxy()
  setAcceptedCompression()
  setRequestCompression()
  setCookie()
  sendPayloadHTTP10()
  sendPayloadHTTPS()
  sendPayloadCURL()
  multicall()
  _try_multicall()

xmlrpcresp:: (6 methods):
  xmlrpcresp()
  faultCode()
  faultString()
  value()
  cookies()
  serialize()

xmlrpcmsg:: (13 methods):
  xmlrpcmsg()
  xml_header()
  xml_footer()
  kindOf()
  createPayload()
  method()
  serialize()
  addParam()
  getParam()
  getNumParams()
  parseResponseFile()
  parseResponseHeaders()
  parseResponse()

xmlrpcval:: (27 methods):
  xmlrpcval()
  addScalar()
  addArray()
  addStruct()
  dump()
  kindOf()
  serializedata()
  serialize()
  serializeval()
  structmemexists()
  structmem()
  structreset()
  structeach()
  getval()
  scalarval()
  scalartyp()
  arraymem()
  arraysize()
  structsize()
  iso8601_encode()
  iso8601_decode()
  php_xmlrpc_decode()
  php_xmlrpc_encode()
  php_xmlrpc_decode_xml()
  decode_chunked()
  guess_encoding()
  is_valid_charset()

Defines 27 functions

  xmlrpc_encode_entitites()
  xmlrpc_se()
  xmlrpc_se_any()
  xmlrpc_ee()
  xmlrpc_ee_fast()
  xmlrpc_cd()
  xmlrpc_dh()

Class: xmlrpc_client  - X-Ref

xmlrpc_client($path, $server='', $port='', $method='')   X-Ref

param: string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
param: string $server the server name / ip address
param: integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
param: string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed

setDebug($in)   X-Ref
No description

setCredentials($u, $p, $t=1)   X-Ref
Add some http BASIC AUTH credentials, used by the client to authenticate

param: string $u username
param: string $p password
param: integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)

setCertificate($cert, $certpass)   X-Ref
Add a client-side https certificate

param: string $cert
param: string $certpass

setCaCertificate($cacert, $is_dir=false)   X-Ref
Add a CA certificate to verify server with (see man page about
CURLOPT_CAINFO for more details

param: string $cacert certificate file name (or dir holding certificates)
param: bool $is_dir set to true to indicate cacert is a dir. defaults to false

setKey($key, $keypass)   X-Ref
Set attributes for SSL communication: private SSL key

param: string $key The name of a file containing a private SSL key
param: string $keypass The secret password needed to use the private SSL key

setSSLVerifyPeer($i)   X-Ref
Set attributes for SSL communication: verify server certificate

param: bool $i enable/disable verification of peer certificate

setSSLVerifyHost($i)   X-Ref
Set attributes for SSL communication: verify match of server cert w. hostname

param: int $i

setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)   X-Ref
Set proxy info

param: string $proxyhost
param: string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
param: string $proxyusername Leave blank if proxy has public access
param: string $proxypassword Leave blank if proxy has public access
param: int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy

setAcceptedCompression($compmethod)   X-Ref
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.

param: string $compmethod either 'gzip', 'deflate', 'any' or ''

setRequestCompression($compmethod)   X-Ref
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)

param: string $compmethod either 'gzip', 'deflate' or ''

setCookie($name, $value='', $path='', $domain='', $port=null)   X-Ref
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

param: string $name
param: string $value
param: string $path
param: string $domain
param: int $port

sendPayloadHTTP10($msg, $server, $port, $timeout=0,$username='', $password='', $authtype=1, $proxyhost='',$proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)   X-Ref
No description

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='')   X-Ref


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='')   X-Ref
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!


multicall($msgs, $timeout=0, $method='', $fallback=true)   X-Ref
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...

param: array $msgs an array of xmlrpcmsg objects
param: integer $timeout connection timeout (in seconds)
param: string $method the http protocol variant to be used
param: boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
return: array

_try_multicall($msgs, $timeout, $method)   X-Ref
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)


Class: xmlrpcresp  - X-Ref

xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')   X-Ref

param: mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
param: integer $fcode set it to anything but 0 to create an error response
param: string $fstr the error string, in case of an error response
param: string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'

faultCode()   X-Ref
Returns the error code of the response.

return: integer the error code of this response (0 for not-error responses)

faultString()   X-Ref
Returns the error code of the response.

return: string the error string of this response ('' for not-error responses)

value()   X-Ref
Returns the value received by the server.

return: mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects

cookies()   X-Ref
Returns an array with the cookies received from the server.
Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
with attributes being e.g. 'expires', 'path', domain'.
NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
are still present in the array. It is up to the user-defined code to decide
how to use the received cookies, and wheter they have to be sent back with the next
request to the server (using xmlrpc_client::setCookie) or not

return: array array of cookies received from the server

serialize($charset_encoding='')   X-Ref
Returns xml representation of the response. XML prologue not included

param: string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
return: string the xml representation of the response

Class: xmlrpcmsg  - X-Ref

xmlrpcmsg($meth, $pars=0)   X-Ref

param: string $meth the name of the method to invoke
param: array $pars array of parameters to be paased to the method (xmlrpcval objects)

xml_header($charset_encoding='')   X-Ref


xml_footer()   X-Ref


kindOf()   X-Ref


createPayload($charset_encoding='')   X-Ref


method($meth='')   X-Ref
Gets/sets the xmlrpc method to be invoked

param: string $meth the method to be set (leave empty not to set it)
return: string the method that will be invoked

serialize($charset_encoding='')   X-Ref
Returns xml representation of the message. XML prologue included

return: string the xml representation of the message, xml prologue included

addParam($par)   X-Ref
Add a parameter to the list of parameters to be used upon method invocation

param: xmlrpcval $par
return: boolean false on failure

getParam($i)   X-Ref
Returns the nth parameter in the message. The index zero-based.

param: integer $i the index of the parameter to fetch (zero based)
return: xmlrpcval the i-th parameter

getNumParams()   X-Ref
Returns the number of parameters in the messge.

return: integer the number of parameters currently set

parseResponseFile($fp)   X-Ref
Given an open file handle, read all data available and parse it as axmlrpc response.
NB: the file handle is not closed by this function.

return: xmlrpcresp

parseResponseHeaders(&$data, $headers_processed=false)   X-Ref
Parses HTTP headers and separates them from data.


parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')   X-Ref
Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object.

param: string $data the xmlrpc response, eventually including http headers
param: bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
param: string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
return: xmlrpcresp

Class: xmlrpcval  - X-Ref

xmlrpcval($val=-1, $type='')   X-Ref

param: mixed $val
param: string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed

addScalar($val, $type='string')   X-Ref
Add a single php value to an (unitialized) xmlrpcval

param: mixed $val
param: string $type
return: int 1 or 0 on failure

addArray($vals)   X-Ref
Add an array of xmlrpcval objects to an xmlrpcval

param: array $vals
return: int 1 or 0 on failure

addStruct($vals)   X-Ref
Add an array of named xmlrpcval objects to an xmlrpcval

param: array $vals
return: int 1 or 0 on failure

dump($ar)   X-Ref
No description

kindOf()   X-Ref
Returns a string containing "struct", "array" or "scalar" describing the base type of the value

return: string

serializedata($typ, $val, $charset_encoding='')   X-Ref


serialize($charset_encoding='')   X-Ref
Returns xml representation of the value. XML prologue not included

param: string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
return: string

serializeval($o)   X-Ref
No description

structmemexists($m)   X-Ref
Checks wheter a struct member with a given name is present.
Works only on xmlrpcvals of type struct.

param: string $m the name of the struct member to be looked up
return: boolean

structmem($m)   X-Ref
Returns the value of a given struct member (an xmlrpcval object in itself).
Will raise a php warning if struct member of given name does not exist

param: string $m the name of the struct member to be looked up
return: xmlrpcval

structreset()   X-Ref
Reset internal pointer for xmlrpcvals of type struct.


structeach()   X-Ref
Return next member element for xmlrpcvals of type struct.

return: xmlrpcval

getval()   X-Ref
No description

scalarval()   X-Ref
Returns the value of a scalar xmlrpcval

return: mixed

scalartyp()   X-Ref
Returns the type of the xmlrpcval.
For integers, 'int' is always returned in place of 'i4'

return: string

arraymem($m)   X-Ref
Returns the m-th member of an xmlrpcval of struct type

param: integer $m the index of the value to be retrieved (zero based)
return: xmlrpcval

arraysize()   X-Ref
Returns the number of members in an xmlrpcval of array type

return: integer

structsize()   X-Ref
Returns the number of members in an xmlrpcval of struct type

return: integer

iso8601_encode($timet, $utc=0)   X-Ref
Given a timestamp, return the corresponding ISO8601 encoded string.

Really, timezones ought to be supported
but the XML-RPC spec says:

"Don't assume a timezone. It should be specified by the server in its
documentation what assumptions it makes about timezones."

These routines always assume localtime unless
$utc is set to 1, in which case UTC is assumed
and an adjustment for locale is made when encoding

param: int $timet (timestamp)
param: int $utc (0 or 1)
return: string

iso8601_decode($idate, $utc=0)   X-Ref
Given an ISO8601 date string, return a timet in the localtime, or UTC

param: string $idate
param: int $utc either 0 or 1
return: int (datetime)

php_xmlrpc_decode($xmlrpc_val, $options=array()   X-Ref
Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.

Works with xmlrpc message objects as input, too.

Given proper options parameter, can rebuild generic php object instances
(provided those have been encoded to xmlrpc format using a corresponding
option in php_xmlrpc_encode())
PLEASE NOTE that rebuilding php objects involves calling their constructor function.
This means that the remote communication end can decide which php code will
get executed on your server, leaving the door possibly open to 'php-injection'
style of attacks (provided you have some classes defined on your server that
might wreak havoc if instances are built outside an appropriate context).
Make sure you trust the remote server/client before eanbling this!

author: Dan Libby (dan@libby.com)
param: xmlrpcval $xmlrpc_val
param: array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
return: mixed

php_xmlrpc_encode($php_val, $options=array()   X-Ref
Takes native php types and encodes them into xmlrpc PHP object format.
It will not re-encode xmlrpcval objects.

Feature creep -- could support more types via optional type argument
(string => datetime support has been added, ??? => base64 not yet)

If given a proper options parameter, php object instances will be encoded
into 'special' xmlrpc values, that can later be decoded into php objects
by calling php_xmlrpc_decode() with a corresponding option

author: Dan Libby (dan@libby.com)
param: mixed $php_val the value to be converted into an xmlrpcval object
param: array $options    can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
return: xmlrpcval

php_xmlrpc_decode_xml($xml_val, $options=array()   X-Ref
Convert the xml representation of a method response, method request or single
xmlrpc value into the appropriate object (a.k.a. deserialize)

param: string $xml_val
param: array $options
return: mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp

decode_chunked($buffer)   X-Ref
decode a string that is encoded w/ "chunked" transfer encoding
as defined in rfc2068 par. 19.4.6
code shamelessly stolen from nusoap library by Dietrich Ayala

param: string $buffer the string to be decoded
return: string

guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)   X-Ref
xml charset encoding guessing helper function.
Tries to determine the charset encoding of an XML chunk
received over HTTP.
NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,
we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
which will be most probably using UTF-8 anyway...

param: string $httpheaders the http Content-type header
param: string $xmlchunk xml content buffer
param: string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)

is_valid_charset($encoding, $validlist)   X-Ref
Checks if a given charset encoding is present in a list of encodings or
if it is a valid subset of any encoding in the list

param: string $encoding charset to be tested
param: mixed $validlist comma separated list of valid charsets (or array of charsets)

Functions
Functions that are not part of a class:

xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')   X-Ref
Convert a string to the correct XML representation in a target charset
To help correct communication of non-ascii chars inside strings, regardless
of the charset used when sending requests, parsing them, sending responses
and parsing responses, an option is to convert all non-ascii chars present in the message
into their equivalent 'charset entity'. Charset entities enumerated this way
are independent of the charset encoding used to transmit them, and all XML
parsers are bound to understand them.
Note that in the std case we are not sending a charset encoding mime type
along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.


xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)   X-Ref
No description

xmlrpc_se_any($parser, $name, $attrs)   X-Ref
No description

xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)   X-Ref
No description

xmlrpc_ee_fast($parser, $name)   X-Ref
No description

xmlrpc_cd($parser, $data)   X-Ref
No description

xmlrpc_dh($parser, $data)   X-Ref
No description



Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1