We use the php xmlrpc library to do xml rpc requests to an email provider.
These have always worked however when testing these features on a new environment (php 5.6 instead of 5.3) it seems that the xmlrpcmsg
won't build in the parameter values when calling xmlrpcmsg::serialize(). Even though the params are clearly there when I var_dump the object.
The way I include the library is through including xmlrpc.inc
(// Copyright (c) 1999,2000,2002 Edd Dumbill.) although I can't find any documentation which may tell me about any extensions that may be required or php version compatibility.
Example:
$this->msg = new xmlrpcmsg(
"contact.transactional", array(
// carer details
new xmlrpcval(
array(
"carer_id" => new xmlrpcval($data['Carer_ID'], "string"),
"email" => new xmlrpcval($data['CarerEmail'], "string"),
), "struct"
),
// campaign_id to be launched
new xmlrpcval($trigger['trigger_id'], "int"),
// transactional data to be passed into email template
new xmlrpcval(
array(
"carer_id" => new xmlrpcval($data['Carer_ID'], "int"),
"baby_id" => new xmlrpcval($data['Baby_ID'], "string"),
"carer_email" => new xmlrpcval($data['CarerEmail'], "string"),
), "struct"
),
)
);
When I var_dump
$this->msg->serialize()
on my local system / the already live server
<methodcall>
<methodname>contact.transactional</methodname>
<params>
<param>
<value>
<struct>
<member>
<name>email</name>
<value>
<string>adam+testest@testest.co.uk</string>
</value>
</member>
</struct>
</value>
<param>
<value>
<int>17458</int>
</value>
<param>
<value>
<struct>
<member>
<name>carer_id</name>
<value>
<string>654321</string>
</value>
</member>
<member>
<name>baby_id</name>
<value>
<string>123456</string>
</value>
</member>
<member>
<name>carer_email</name>
<value>
<string>adam+testest@testest.co.uk</string>
</value>
</member>
</struct>
</value>
</params>
</methodcall>
When I var_dump
$this->msg->serialize()
on the new testing server
<methodcall>
<methodname>contact.transactional</methodname>
<params>
<param>
<value></value>
<param>
<value></value>
<param>
<value></value>
</params>
</methodcall>
Looks like I just needed to update the library to the latest version phpxmlrpc at github