/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function connect() { var $user = 'admin'; var $password = 'admin'; var $dbname = 'db_name'; var $server_url = 'http://localhost:8069/xmlrpc/'; if($_COOKIE["user_id"]>0) { return $_COOKIE["user_id"]; } } $sock = new xmlrpc_client($server_url.'common'); $msg = new xmlrpcmsg('login'); $msg->addParam(new xmlrpcval($dbname, "string")); $msg->addParam(new xmlrpcval($user, "string")); $msg->addParam(new xmlrpcval($password, "string")); $resp = $sock->send($msg); $val = $resp->value(); $id = $val->scalarval(); if($id > 0) { return $id; }else{ return -1; } }
URL: http://doc.openerp.com/developer/6_22_XML-RPC_web_services/