Hi All,
I am writing a XML RPC in PHP but am having error. here below is the code
clients.php
<?php
/* Include the library */
include ( "kd_xmlrpc.php" );
/* Define variables to find the rpc server script */
$site = "localhost";
$location = "/xml-rpc/server.php";
function convert_date ( $date ) {
$date = date ( "D M y H:i:s",XMLRPC_convert_iso8601_to_timestamp ( $date ) );
return ( $date );
}
$response=array();
list($success, $response) = XMLRPC_request($site,$location,'sum.add', array(XMLRPC_prepare(2),"4"));
if($success){
echo $response[0];
}
?>
server.php
<?php
/* Include the library */
include ( "kd_xmlrpc.php" );
include ( "config.php" );
/* Now use the XMLRPC_parse function to take POST
data from what xml-rpc client connects and turn
it into normal PHP variables */
request=XMLRPC_parse($GLOBALS['HTTP_RAW_POST_DATA']);
/* From the PHP variables generated, let's get the
method name ie. server asks "What would you like
me to do for you?" */
$methodName = XMLRPC_getMethodName($request);
/* Get the parameters associated with that method
e.g "So you want to view a news item. Tell me
which one you want. What's the id#?" */
$params = XMLRPC_getParams($request);
$param=$params[0];
$param+=$param;
XMLRPC_response(XMLRPC_prepare($param),KD_XMLRPC_USERAGENT);
$sql="INSERT INTO `tests`.`tests` (`id` ,`method` ,`data` )VALUES (NULL , '$methodName', '$param')";
mysql_query($sql) or die(mysql_error());
?>
the error am getting is Notice: Uninitialized string offset: 0 in C:\wamp\www\xml-rpc\client.php on line 18
Kindly help