Trouble with XML RPC function parameters
I'm having trouble with reading the data from parameters I'm passing in
XML RPC. I have the following PHP function:
function denyPendingRequest($method, $params)
{
//param[0] is just the id of the request to deny
$toDelete = $params[0];
$query = "delete from licenserequests where id=$toDelete;";
global $dbconnection;
$result = pg_query($dbconnection, $query);
}
The function request looks like this when I NSLog it:
<?xml version="1.0"?>
<methodCall>
<methodName>denyPendingRequest</methodName>
<params>
<param>
<value>
<array>
<data>
<value>
<i4>19</i4>
</value>
<value>
<i4>5</i4>
</value>
</data>
</array>
</value>
</param>
</params>
</methodCall>
I know that the request is valid. The only problem I'm having is actually
reading the parameters. For example, if I do the following:
function denyPendingRequest($method, $params)
{
//param[0] is just the id of the request to deny
$toDelete = $params[0];
echo "TO DELETE: " . $toDelete;
$query = "delete from licenserequests where id=$toDelete;";
global $dbconnection;
$result = pg_query($dbconnection, $query);
}
The response is: TO DELETE: Array when it should be TO DELETE: 19 in this
case.
I'm perplexed as to why $params[0] is an Array when it should be an 4 Byte
int. Is there a function I'm not aware of that I need to perform on
$params in order to use it or the return value as a native php array?
No comments:
Post a Comment