XML-RPC Variable type detection

XML-RPC is clever enough to automatically detect the data type of the parameters passed to it in the xmlrpc_encode_request function.

Example code:

<?php
$intvar = "77";
settype($intvar, "integer");
$req = xmlrpc_encode_request("NameOfRemoteCall', $intvar);
echo $req;
?>

Output:

<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>NameOfRemoteCall</methodName>
<params>
<param>
<value><int>77</int></value>
</param>
</params>
</methodCall>
Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

 

 
eXTReMe Tracker