Passing arguments as array into xmlrpc

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
mykmallett's picture

Is it possible to pass a key => value paired array into the xmlrpc request? As I am trying to make a request function that is usable by method requests with differing variable numbers and types

$xmlrpc_result = xmlrpc($server, $method, $hash, $domain, $timestamp, $nonce, $sid, $args, array());

Where $args contains
array(
'variable1' => '1',
'variable2' => '2' etc,
)

Obviously implode doesn't work to separate the variables in a comma separated list, because the entire list is just string...I can seperate the list into the variable name being the index name like
$variable1 = 1, $variable2 = 2. But then I have the problem of adding them all to the xmlpc function.

To get the variables from the array I would do this:

<?php
$fruit
= array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');

reset($fruit);
while (list(
$key, $val) = each($fruit)) {
   echo
$val, ";
}
?>

But again, I run into problems because I can't put those variables into the function, because the comma separating them would be a string and I don't think there's a way to 'echo' out anything except numbers or a string.

There must be a way to tell services to receive an array of arguments? It seems like a particularly obvious and sensible thing to do

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: