Hi, I am trying to write a code to access the node (10) in a drupal website which has service module enabled but the debugger said I am Missing required arguments. I know it has something to do with my '$key' and '$m'. Wonder if anybody can help. The following is my code. Thanks for any help in advance. <?php include("xmlrpc300beta/lib/xmlrpc.inc"); $domain = 'sample.com'; $apiKey = '55f7eaxxx00758c8a92xxxb9121abc36'; $endPoint = 'http://www.sample.com/services/xmlrpc'; $methodName = "node.view"; $timestamp = (string)time(); $code = md5(uniqid(rand(), true)); $nonce = substr($code, 0, 20); $hash = hash_hmac('sha256', $timestamp .';'.$domain .';'. $nonce .';'. $methodName, $api_key); $c = new xmlrpc_client($endPoint); $c->setDebug(1); $key = new xmlrpcval( array( "hash" => new xmlrpcval($hash, "string"), "method" => new xmlrpcval($methodName, "string"), "domain_name" => new xmlrpcval($domain, "string"), "domain_time_stamp" => new xmlrpcval($timestamp, "string"), "nonce" => new xmlrpcval($nonce, "string"), "api_key" => new xmlrpcval($apiKey, "string"), "nid" => new xmlrpcval(10, "int") ), "struct"); $m = new xmlrpcmsg($methodName,$key); $c->return_type = 'phpvals'; $r = $c->send($m); var_dump($r->value()); ?>
Change the original $key to the following and $methodName = 'node.get' and it works. But somehow it is not working when $methodName = 'node.view' which take the same required arguments as node.get. $key = array( new xmlrpcval($hash, "string"), new xmlrpcval($domain_name, "string"), new xmlrpcval($domain_time_stamp, "string"), new xmlrpcval($nonce, "string"), new xmlrpcval(10, "int") );