Search code examples
phpxml-rpcxmlrpcclient

Sending an array in XMLRPC?


I cant figure out whats wrong with this:

$message = new xmlrpcmsg('service.RegistrationDetails',
    array(new xmlrpcval(
         array('EventId' => new xmlrpxval($EventId, "int"), 
             'ParticipantId' => new xmlrpxval($usrId, "int")), 'array') 
    )
);

its as per the documentation on - http://phpxmlrpc.sourceforge.net/doc/xmlrpcval.html

but the above crashes

$result = $server->send($message);

I tried:

$message = new xmlrpcmsg('service.RegistrationDetails',
    new xmlrpcval(
         array('EventId' => new xmlrpxval($EventId, "int"), 
             'ParticipantId' => new xmlrpxval($usrId, "int")), 'array') 
);

but that didnt work either


my bad! i had a typo in there - "xmlrpxval" instead of "xmlrpcval". i think the second should work, but not sure...


Solution

  • This worked perfectly:

    $message = new xmlrpcmsg('abc.abcDetails', array(new xmlrpcval($cId, 'int'), new xmlrpcval($dStr,'string') ));