• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

API RPC authentification error

albans

Regular Pleskian
Hi,

I'm trying to use the Plesk RPC API, and I can't log-in correctly.

I use the following PHP code, taken from several example I found:
define ('HOST', 'myserver.com');
define ('PORT', 8443);
define ('PATH', 'enterprise/control/agent.php');

$url = 'https://' . HOST . ':' . PORT . '/' . PATH;

echo $url;

$headers = array(
'HTTP_AUTH_LOGIN: admin',
'HTTP_AUTH_PASSWD: xxxx',
'Content-Type: text/xml'
);


// initialize the curl engine
$ch = curl_init();

// set the curl options:
// do not check the name of SSL certificate of the remote server
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);

// do not check up the remote server certificate
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

// pass in the header elements
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

// pass in the url of the target server
curl_setopt($ch, CURLOPT_URL, $url);

// tell CURL to return the result rather than to load it to the browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, true);

I always get the following error, when I try with the admin login.

error 1001 Authentication failed - wrong password.

Should I use another login? I tried with the login of the client level user and it didn't work either.

Thanks!
 
Okay, fantastic: I SOLVED THE PROBLEM!!!
It was linked to the length of my password (> 15 caracters)...
I simply modified it to a shorter one, and everything's running smoothly!
So, I guess it's good to know not to lose days tryin' ;o)
 
Back
Top