Hi all :)
I'm working on Odoo External API for my website using PHP 7.
The XML RPC and OpenSSL extensions are enabled on my server, and the website is even secured (there's the lock icon in the address bar).
For now, we want to test it with Odoo Demo Trial. So in my php code, I have put the same username/password as the one I use to connect to my odoo demo account.
1°) But I'm getting faultCode and faultString (Access Denied)
$url = 'https://lgb-test.odoo.com'; // Odoo Demo Trial
$db = 'lgb-test';
$username = 'johndoe@mywebsiteexample.com'; /* Same Email as the one to connect to https://lgb-test.odoo.com/web/login */
$password = 'mypasswordexample'; /* Same Password as the one to connect to https://lgb-test.odoo.com/web/login */
require_once('ripcord/ripcord.php');
$common = ripcord::client($url.'/xmlrpc/2/common');
$uid = $common->authenticate($db, $username, $password, array());
echo('UID:');
var_dump($uid);
echo('<br/>');
$models = ripcord::client("$url/xmlrpc/2/object");
$partners = $models->execute_kw(
$db,
$uid,
$password,
'res.partner',
'search',
array(
array(
array('is_company', '=', true)
)
)
);
echo('RESULT:<br/>');
foreach ($partners as $partner) {
echo 'partner=['.$partner.']<br/>';
}
echo('VAR_DUMP:<br/>');
var_dump($partners);
Output :
UID:bool(false)
RESULT:
partner=[3]
partner=[Access Denied]
VAR_DUMP:
array(2) { ["faultCode"]=> int(3) ["faultString"]=> string(13) "Access Denied" }
2°) When the start( ) method is called, I get Fatal error: Uncaught Ripcord_TransportException: Could not access
require_once('ripcord/ripcord.php');
$info = ripcord::client('https://lgb-test.odoo.com/start/')->start();
echo 'hello';
Output :
Fatal error: Uncaught Ripcord_TransportException: Could not access https://lgb-test.odoo.com/start/ in /var/www/vhosts/mywebsiteexample.com/preprod.mywebsiteexample.com/ripcord/ripcord_client.php:488 Stack trace: #0 /var/www/vhosts/mywebsiteexample.com/preprod.mywebsiteexample.com/ripcord/ripcord_client.php(228): Ripcord_Transport_Stream->post('https://lgb-tes...', '<?xml version="...') #1 /var/www/vhosts/mywebsiteexample.com/preprod.mywebsiteexample.com/index.php(10): Ripcord_Client->__call('start', Array) #2 {main} thrown in /var/www/vhosts/mywebsiteexample.com/preprod.mywebsiteexample.com/ripcord/ripcord_client.php on line 488
This problem doesn't seem to be an isolated case for years, but I didn't find the right answer yet.
Could anyone help please ?