Skip to Content
Menu
This question has been flagged
3416 Views

I had created a PHP class to connect to it.

The class works fine when I execute it through the localhost. But when I upload the files on a live server, it gives an error:

"Unable to login Connect error: Connection timed out (110)"

Here is the class I have created.

include_once("xmlrpc.inc");
class OdooXmlrpc {
    private $user, $password, $database, $services, $client, $res, $msg, $id;
    function __construct($usr, $pass, $db, $server) {
      $this->user = $usr;
      $this->password = $pass;
      $this->database = $db;
      $this->services = $server;
      $this->client = new xmlrpc_client($this->services.'common');
      $this->msg = new xmlrpcmsg('login');
      $this->msg->addParam(new xmlrpcval($this->database, "string"));
      $this->msg->addParam(new xmlrpcval($this->user, "string"));   
      $this->msg->addParam(new xmlrpcval($this->password, "string"));
      $this->res =  &$this->client->send($this->msg);
      if(!$this->res->faultCode()){
         $this->id = $this->res->value()->scalarval();
      }
      else {
         echo "Unable to login ".$this->res->faultString();
         exit;
      }
   }
Avatar
Discard
Related Posts Replies Views Activity
0
Mar 18
3568
0
Jun 16
3008
0
May 16
2769
2
Mar 15
9593
1
Mar 15
6689