I’m running this on a server, using Joomla’s implementation of XMLRPC for PHP. Whatever xmlrpcval I try to send (including null) is not sent. Instead, an empty array is sent.
Relevant Master code. I’ve tried different varieties of xmlrpcmsg sent (from a complicated array to a simple string):
$articleData = new xmlrpcmsg("insertContent", array(new xmlrpcval($articleArray, "struct")));
$client = new xmlrpc_client("/administrator/components/com_quickagencyslave/remote/easyblog.php", $clientArray["url"]);
$response = $client->send($articleData);
Slave code (not actual functionality, just trying to get it to work:
function insertContent($params){
$data = $params->getParam(0);
$result = gettype($data);
return new xmlrpcresp(new xmlrpcval($result));
}
Return codes show that $data is of type NULL. What am I doing wrong?
As it turns out XMLRPC is very strict about what data it will accept (something that isn’t entirely reflected in the docs). An array can’t contain plain objects, even if that array has been converted into an XMLRPC object. The code below wraps an array and everything in it into an XMLRPC struct: