I have the following array
Array ( [value] => Array ( [mf_account] => xxxxx [mf_username] => xxxx [mf_password] => xxxx [as_user_id-int] => e [page-int] => d [page_size-int] => x [get_campaign] => Submit [form_build_id] => form-w1vXG5j2hEeKjKYGomZjuwxWlXqbrGg5tG4ph81J3Xk [form_token] => 9onu89rRyvEWWVtSJpAUw4Ko81sitmo9BpbqtoVD110 [form_id] => messagefocus_settings_all_campaign ) )
I need this array to be formatted so that it's suitable for xmlrpc_client
If I hard code the array like the following it works
$msg = new xmlrpcmsg(
"campaign.all",
array(
new xmlrpcval(
array(
"as_user_id"=> new xmlrpcval('122', "int"),
"page"=> new xmlrpcval('33', "int"),
"page_size"=> new xmlrpcval('23', "int"),
),"struct"
)
)
);
Unfortunately I have too many forms to hard code handlers for all of them so I would really like to have one function that can loop through an array that has not yet been formatted and parses the values as required.
So far I have tried this but I am just getting errors back.
//Please ignore all parts of the if statement except the final else
$temp = new xmlrpcmsg();
foreach ($data as $key => $value) {
if($key == 'get_campaign'){
break;
}elseif ($key == 'mf_account' || $key == 'mf_username' || $key == 'mf_password') {
$credentials[$key] = $value;
}else{
//this is where my problems occurs
$keyValues = split('-', $key);
$temp[$keyValues[0]] => new xmlrpcval($value, $keyValues[1]);
}
}
For me debugging this is made doubly awkward because I have to develop it inside drupal and the form is processed through ajax meaning the only error that I'm getting back is
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Internal Server Error
ResponseText: