Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3647 Переглядів

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;
      }
   }
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 18
4122
0
черв. 16
3263
0
трав. 16
3003
2
бер. 15
10267
1
бер. 15
7396