The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cPanel API with Secure Connection

Discussion in 'cPanel Developers' started by Albatati, Dec 4, 2014.

  1. Albatati

    Albatati Registered

    Joined:
    Dec 4, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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!
     
  2. Albatati

    Albatati Registered

    Joined:
    Dec 4, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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?
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,706
    Likes Received:
    658
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  4. Albatati

    Albatati Registered

    Joined:
    Dec 4, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,706
    Likes Received:
    658
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page