cPanel API with Secure Connection

Albatati

Registered
Dec 4, 2014
3
0
1
cPanel Access Level
Website Owner
Hi Everyone,

I’m facing strange problem. I hope one of Cpanel experts can solve it.
The following code is to create database for cpanel remotely using Cpanel API (without Root credentials):

Code:
<?php  
include("xmlapi.php"); 
$db_host = "213.136.xx.xxx"; 
$cpaneluser = "cpanelusername"; 
$cpanelpass= "cpanelpassword"; 
$xmlapi = new xmlapi($db_host); 
$xmlapi->set_port( '2082' );   // PORT SETTING
$xmlapi->password_auth("".$cpaneluser."","".$cpanelpass."");    
$xmlapi->set_debug(1);//output actions in the error log 1 for true and 0 false  
$xmlapi->set_output('array');//set this for browser output  
//create database    
$databasename="dbname";
$createdb = $xmlapi->api1_query($cpaneluser, "Mysql", "adddb", array($databasename));   
 echo "Good Job";
?>
This work fine IF I set
Server Configuration »Tweak Settings » Security »Tweak Settings» Require SSL => OFF

However, I want it through secure connection. So I modified the code to use port 2083 instead ($xmlapi->set_port( '2083' ); // PORT SETTING).
But, it does not work (connection time out). Same problem happened even If I modified the server configuration to require SSL:
Server Configuration »Tweak Settings » Security »Tweak Settings» Require SSL => ON

Any help, idea. Plz share you experience!
 

Albatati

Registered
Dec 4, 2014
3
0
1
cPanel Access Level
Website Owner
Hi,
I hired a company to solve this, they told me that the cpanel domain itself should be SSL certified. (I create that domain for testing, so it is not a qualified domain)

My WHM/cPanel server has SSL installed. And the connection is to server not to that cpanel domain. I do not think, this is the reason, what do you think?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello :)

Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

Albatati

Registered
Dec 4, 2014
3
0
1
cPanel Access Level
Website Owner
Hello,
Thanks for your reply,
The problem is resolved.It was coming form the hosting provider that I'm running the script from.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
I am happy to see you were able to address the issue. Thank you for updating us with the outcome.