Documentation

xmlrpc.php

Table of Contents

Classes

xmlrpc_client
xmlrpcresp
xmlrpcmsg
xmlrpcval

Constants

PHP_XMLRPC_COMPAT_DIR  = \dirname(__FILE__) . '/compat/'
XMLRPC_EPI_ENABLED  = '0'

Functions

xmlrpc_encode_entitites()  : mixed
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.
xmlrpc_se()  : mixed
xmlrpc_se_any()  : mixed
xmlrpc_ee()  : mixed
xmlrpc_ee_fast()  : mixed
xmlrpc_cd()  : mixed
xmlrpc_dh()  : mixed
iso8601_encode()  : string
Given a timestamp, return the corresponding ISO8601 encoded string.
iso8601_decode()  : int
Given an ISO8601 date string, return a timet in the localtime, or UTC
php_xmlrpc_decode()  : mixed
Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.
php_xmlrpc_encode()  : xmlrpcval
Takes native php types and encodes them into xmlrpc PHP object format.
php_xmlrpc_decode_xml()  : mixed
Convert the xml representation of a method response, method request or single xmlrpc value into the appropriate object (a.k.a. deserialize)
decode_chunked()  : string
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
guess_encoding()  : mixed
xml charset encoding guessing helper function.
is_valid_charset()  : mixed
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

Constants

PHP_XMLRPC_COMPAT_DIR

public mixed PHP_XMLRPC_COMPAT_DIR = \dirname(__FILE__) . '/compat/'

XMLRPC_EPI_ENABLED

public mixed XMLRPC_EPI_ENABLED = '0'

Functions

xmlrpc_encode_entitites()

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.

xmlrpc_encode_entitites(mixed $data[, mixed $src_encoding = '' ][, mixed $dest_encoding = '' ]) : mixed

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.

Parameters
$data : mixed
$src_encoding : mixed = ''
$dest_encoding : mixed = ''
Tags
todo

do a bit of basic benchmarking (strtr vs. str_replace)

todo

make usage of iconv() or recode_string() or mb_string() where available

xmlrpc_se()

xmlrpc_se(mixed $parser, mixed $name, mixed $attrs[, mixed $accept_single_vals = false ]) : mixed
Parameters
$parser : mixed
$name : mixed
$attrs : mixed
$accept_single_vals : mixed = false

xmlrpc_se_any()

xmlrpc_se_any(mixed $parser, mixed $name, mixed $attrs) : mixed
Parameters
$parser : mixed
$name : mixed
$attrs : mixed

xmlrpc_ee()

xmlrpc_ee(mixed $parser, mixed $name[, mixed $rebuild_xmlrpcvals = true ]) : mixed
Parameters
$parser : mixed
$name : mixed
$rebuild_xmlrpcvals : mixed = true

xmlrpc_ee_fast()

xmlrpc_ee_fast(mixed $parser, mixed $name) : mixed
Parameters
$parser : mixed
$name : mixed

xmlrpc_cd()

xmlrpc_cd(mixed $parser, mixed $data) : mixed
Parameters
$parser : mixed
$data : mixed

xmlrpc_dh()

xmlrpc_dh(mixed $parser, mixed $data) : mixed
Parameters
$parser : mixed
$data : mixed

iso8601_encode()

Given a timestamp, return the corresponding ISO8601 encoded string.

iso8601_encode(int $timet[, int $utc = 0 ]) : 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

Parameters
$timet : int

(timestamp)

$utc : int = 0

(0 or 1)

Return values
string

iso8601_decode()

Given an ISO8601 date string, return a timet in the localtime, or UTC

iso8601_decode(string $idate[, int $utc = 0 ]) : int
Parameters
$idate : string
$utc : int = 0

either 0 or 1

Return values
int

(datetime)

php_xmlrpc_decode()

Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.

php_xmlrpc_decode(xmlrpcval $xmlrpc_val[, array<string|int, mixed> $options = array() ]) : mixed

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!

Parameters
$xmlrpc_val : xmlrpcval
$options : array<string|int, mixed> = array()

if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects

Tags
author

Dan Libby (dan@libby.com)

php_xmlrpc_encode()

Takes native php types and encodes them into xmlrpc PHP object format.

& php_xmlrpc_encode(mixed $php_val[, array<string|int, mixed> $options = array() ]) : xmlrpcval

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

Parameters
$php_val : mixed

the value to be converted into an xmlrpcval object

$options : array<string|int, mixed> = array()

can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'

Tags
author

Dan Libby (dan@libby.com)

Return values
xmlrpcval

php_xmlrpc_decode_xml()

Convert the xml representation of a method response, method request or single xmlrpc value into the appropriate object (a.k.a. deserialize)

php_xmlrpc_decode_xml(string $xml_val[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$xml_val : string
$options : array<string|int, mixed> = array()
Return values
mixed

false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp

decode_chunked()

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

decode_chunked(string $buffer) : string
Parameters
$buffer : string

the string to be decoded

Return values
string

guess_encoding()

xml charset encoding guessing helper function.

guess_encoding([mixed $httpheader = '' ][, string $xmlchunk = '' ][, string $encoding_prefs = null ]) : mixed

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...

Parameters
$httpheader : mixed = ''
$xmlchunk : string = ''

xml content buffer

$encoding_prefs : string = null

comma separated list of character encodings to be used as default (when mb extension is enabled)

Tags
todo

explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!

is_valid_charset()

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

is_valid_charset(string $encoding, mixed $validlist) : mixed
Parameters
$encoding : string

charset to be tested

$validlist : mixed

comma separated list of valid charsets (or array of charsets)


        
On this page

Search results