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.

verifying cpanel is connectable via API

Discussion in 'cPanel Developers' started by kevin77, Sep 22, 2011.

  1. kevin77

    kevin77 Registered

    Joined:
    Sep 22, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    i am just trying to run a check to make sure that the credentials used for cpanel work, however, my code is not working at all. it seems that i get the message "connected to cpanel" even if i am using credentials that i know are not working.

    heres the code

    Code:
        $cpCfg = array(
            'cpanel'=>array(
                'service'=>array(
                    'cpanel' => array(
                        'host' => $_POST['cpanel_host'],
                        'user' => $_POST['cpanel_username'],
                        'password' => $_POST['cpanel_password'],
                    )
                )
            )
        );
        
        if ($cp = Cpanel_PublicAPI::getInstance($cpCfg))
        {
            echo 'connected to cpanel';
        }
        else
        {
            echo 'failed to connect to cpanel';
        }
    
    like i said, no matter what i enter in the form, i get the same result - "connected to cpanel"
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi kevin77,

    No authentication attempt is performed until you make an API request. The return value from getInstance is simply an object that will allow you to make said queries.

    Regards,
    -DavidN
     
Loading...

Share This Page