Skip to content

Commit

Permalink
Allow custom parameters in php_xmlrpc_encode() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Mar 14, 2017
1 parent 140953e commit 7ff78d8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
6 changes: 4 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
XML-RPC for PHP EXTRAS version 0.6 - 2017/3/14

Accept non-standard options in calls to xmlrpc_encode_request
* Accept non-standard options in calls to xmlrpc_encode_request

* Reformat most php code and minor doc improvements


XML-RPC for PHP EXTRAS version 0.5.2 - 2014/12/7
Expand Down Expand Up @@ -116,7 +118,7 @@ Might be useful in defining some wsdl file describing xmlrpc services (good luck
The DTD is not quite accurate, due to limitations in the definition language.
RELAX NG should be 100% precise and accurate.

DOCXMLRPCSERVER:
DOCXMLRPCS:
----------------------------------------
Subclass of xmlrpc server that self-generates HTML documentation of exposed services.
Easy as a breeze to use, and extremely user-friendly.
Expand Down
34 changes: 21 additions & 13 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,35 @@ PHP-XMLRPC Extras

## INCLUDED PACKAGES:

### WSDL:
The completely UNOFFICIAL DTD and RELAX NG schemas to validate your xmlrpc against.
Might be useful in defining some wsdl file describing xmlrpc services (good luck!!!).
The DTD is not quite accurate, due to limitations in the definition language.
RELAX NG should be 100% precise and accurate.
### ADODB:
Provides an easy mean of connecting applications to remote databases using a web service protocol instead of a
native database driver.

### AJAX:
Demo of ajaxified version of xmlrpc lib: supports executing xmlrpc/jsonrpc calls
directly from the client browser.
Needs the excellent jsolait lib from http://jsolait.net/ (thanks Jan Kollhof)

### DOCXMLRPCSERVER:
Subclass of xmlrpc server that self-generates HTML documentation of exposed services.
Easy as a breeze to use, and extremely user-friendly.

PROXY:
Subclass of xmlrpc server that can act as remote (transparent) xmlrpc proxy to forward calls to a remote server.
Can either forward any received call or probe remote server first for existing methods.

### JSONRPC:
Support for this brand new trendy protocol, 100% buzzword-compliant and ajax-ready.
Client and server classes provided.
Makes it very easy to build a server that supports both protocols at the same time.
Original JSON parsing code from Michal Migurski (whose lib is now officially part of PEAR).

### AJAX:
Demo of ajaxified version of xmlrpc lib: supports executing xmlrpc/jsonrpc calls
directly from the client browser.
Needs the excellent jsolait lib from http://jsolait.net/ (thanks Jan Kollhof)
### PROXY:
Subclass of xmlrpc server that can act as remote (transparent) xmlrpc proxy to forward calls to a remote server.
Can either forward any received call or probe remote server first for existing methods.

### WSDL:
The completely UNOFFICIAL DTD and RELAX NG schemas to validate your xmlrpc against.
Might be useful in defining some wsdl file describing xmlrpc services (good luck!!!).
The DTD is not quite accurate, due to limitations in the definition language.
RELAX NG should be 100% precise and accurate.

### XMLRPC_EXTENSION_API
Provides drop_in support for th php native xmlrpc extension, for when your code depends on it, but you can not
install it on the server.
6 changes: 4 additions & 2 deletions xmlrpc_extension_api/xmlrpc_extension_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ if (!in_array('xmlrpc', get_loaded_extensions())) {
*/
function xmlrpc_encode_request($meth, $vals, $opts = null)
{
$opts = array_merge($opts, array('extension_api'));

if ($meth !== null) {
// mimic EPI behaviour: if ($val === NULL) then send NO parameters
if (!is_array($vals)) {
Expand All @@ -141,7 +143,7 @@ if (!in_array('xmlrpc', get_loaded_extensions())) {
}
$values = array();
foreach ($vals as $key => $value) {
$values[] = php_xmlrpc_encode($value, array('extension_api'));
$values[] = php_xmlrpc_encode($value, $opts);
}

// create request
Expand All @@ -152,7 +154,7 @@ if (!in_array('xmlrpc', get_loaded_extensions())) {
if (is_array($vals) && xmlrpc_is_fault($vals))
$req = new xmlrpcresp(0, (integer)$vals['faultCode'], (string)$vals['faultString']);
else
$req = new xmlrpcresp(php_xmlrpc_encode($vals, array('extension_api')));
$req = new xmlrpcresp(php_xmlrpc_encode($vals, $opts));
$resp = "<?xml version=\"1.0\"?" . ">\n" . $req->serialize();
}
return $resp;
Expand Down

0 comments on commit 7ff78d8

Please sign in to comment.