Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

What command to login to OpenERP by XML-RPC from my website instead of OpenERP login page ?

By
GonG
on 7/1/14, 6:10 AM 1,848 views

Hi, I've been playing with XML-RPC with OpenERP. It's finally can read data from OpenERP after fighting with tons of error. It seems to be at last step in use this XML-RPC to pass through OpenERP login page ( from my imagination :) ). Is this possible with XML-RPC, what command to instruct this process ? The document only shows CRUD operation.

1
ThackerS (ts)
On 8/20/14, 10:31 PM

Hi GonG.
With php, firstly downloads the xmlrpc library for php PHPXML-RPC. Downloads the 2.2.2 version.
In your php file, type :

<?php
include('xmlrpc.inc'); // inclusion of the phpxml-rpc library

$user = 'admin'; //your openerp user
$password = 'demo'; // the database password
$dbname = 'demo'; // the database

$server_url = 'http://your_ip:8069'; //connexion
$connexion = new xmlrpc_client($server_url . "/xmlrpc/common");
$connexion->setSSLVerifyPeer(0);

$c_msg = new xmlrpcmsg('login');
$c_msg->addParam(new xmlrpcval($dbname, "string"));
$c_msg->addParam(new xmlrpcval($user, "string"));
$c_msg->addParam(new xmlrpcval($password, "string"));
$c_response = $connexion->send($c_msg);


if ($c_response->errno != 0){

// failed connection
    echo  '<p>error : ' . $c_response->faultString() . '</p>';
}
else{
//successful connection

    $uid = $c_response->value()->scalarval();
    echo "  The user ID ( UID)  : ".$uid;

}

?>

NB: If the connexion succeed, you obtain the user id (uid).
This link (http://thierry-godin.developpez.com/openerp/openerp-xmlrpc-php-fr/) can help you.
Best reagrds.

0

please go through https://doc.openerp.com/6.0/developer/6_22_XML-RPC_web_services/ document, might be helpful for you. 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/1/14, 6:10 AM
Seen: 1848 times
Last updated: 3/16/15, 8:10 AM