===== Query XMLRPC doo with PHP ===== Updated example of the webkul guys. Check references. ==== Install phpxmlrpc ==== Download tarball from website https://github.com/gggeek/phpxmlrpc/releases and copy src/ directory to the working directory. ==== Example ==== The following example authenticates on database and creates a customer: addParam(new PhpXmlRpc\Value($dbname, "string")); $sock_msg->addParam(new PhpXmlRpc\Value($user, "string")); $sock_msg->addParam(new PhpXmlRpc\Value ($pwd, "string")); $sock_resp = $sock->send($sock_msg); if ($sock_resp->errno != 0){ echo 'error'; } else { $sock_val = $sock_resp->value(); $user_id = $sock_val->scalarval(); } if ($user_id != "None") { $customer_array = array( 'name'=>new PhpXmlRpc\Value('Demo Customer', "string"), 'customer_rank'=>new PhpXmlRpc\Value(1, "int") ); $client = new PhpXmlRpc\Client($url.'/xmlrpc/2/object'); $msg = new PhpXmlRpc\Request('execute'); $msg->addParam(new PhpXmlRpc\Value($dbname, "string")); $msg->addParam(new PhpXmlRpc\Value($user_id, "int")); $msg->addParam(new PhpXmlRpc\Value($pwd, "string")); $msg->addParam(new PhpXmlRpc\Value("res.partner", "string")); $msg->addParam(new PhpXmlRpc\Value("create", "string")); $msg->addParam(new PhpXmlRpc\Value($customer_array, "struct")); $resp = $client->send($msg); $customer_id = $resp->value()->scalarval(); } ?> ==== References ==== * https://github.com/gggeek/phpxmlrpc/blob/master/doc/api_changes_v4.md * https://webkul.com/blog/openerp7-0-with-php-using-xml-rpcreadwrite-and-search-method/ * https://webkul.com/blog/openerp-7-0-connection-with-php-using-xml-rpc/