Results 1 to 6 of 6

Thread: cPanel API PHP

  1. #1
    Join Date
    Dec 2004
    Posts
    30

    cPanel API PHP

    I'm using cPanel's API to list all the packages on a reseller account.

    However, I have a problem - I don't know what key in the $value array corresponds to which feature of a package. I've been able to figure out the obvious like $value[2] is the space in the package.

    PHP Code:
     $package $_GET['package'];
    $pkgs listpkgs($whm_host,$whm_username,$whm_hash,$whm_ss  l);

            foreach(
    $pkgs as $name=>$value)
                {
                if(
    $name == $package)
                    {
                    echo 
    "<p>Package: $package<br>";
                    echo 
    "Space: $value[2] MB<br>";
                    echo 
    "Shell Access: <br>";
                    echo 
    "FTP Accounts: <br>";
                    echo 
    "MySQL Databases: <br>";
                    echo 
    "Email Accounts: <br>";
                    echo 
    "Email Lists: <br>";
                    echo 
    "Subdomains: <br>";
                    echo 
    "Addon Domains: <br>";
                    echo 
    "Parked Domains: <br>";
                    echo 
    "Dedicated IP: <br>";
                    echo 
    "CGI: <br>";
                    echo 
    "Front Page Extensions: <br>";
                    echo 
    "cPanel Theme: $value[5] <br>";
                    echo 
    "Bandwidth: $value[10] MB<br>";
                    echo 
    "Features: $value[14] </p>";
                    }

    Can anyone help me determine what is the variable for each of the features? Thanks. I appreciate it a lot.

  2. #2
    Create a fake package and put a unique number in each feature. That's a way to find them out.

  3. #3
    Join Date
    Dec 2004
    Posts
    30
    I figured it out, but I don't know about the ip and shell access...they are both boolean - they are either $value[0] or $value[11] - If anyone knows, please let me know...I would appreciate it so much.

    Thanks.

    PHP Code:
            foreach($pkgs as $name=>$value)
                {
                if(
    $name == $package
                    echo 
    "<p>Package: $package<br>";
                    echo 
    "Space: $value[2] MB<br>"
                    echo 
    "Shell Access: $value[0]<br>"// not sure
                    
    echo "FTP Accounts: $value[5]<br>";
                    echo 
    "MySQL Databases: $value[6]<br>";
                    echo 
    "Email Accounts: $value[7]<br>";
                    echo 
    "Email Lists: $value[12]<br>";
                    echo 
    "Subdomains: $value[9]<br>";
                    echo 
    "Addon Domains: $value[13]<br>";
                    echo 
    "Parked Domains: $value[12]<br>";
                    echo 
    "Dedicated IP: $value[11]<br>"// not sure
                    
    echo "CGI: $value[1]<br>";
                    echo 
    "Front Page Extensions: $value[3]<br>";
                    echo 
    "cPanel Theme: $value[4] <br>";
                    echo 
    "Bandwidth: $value[10] MB<br>";
                    echo 
    "Features: $value[14] </p>";

                }
                } 

  4. #4
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,683
    Turn one on and the other off, that will show you which is which! ie: turn shell on and leave IP off.

  5. #5
    Join Date
    Dec 2004
    Posts
    30
    Originally posted by brianoz
    Turn one on and the other off, that will show you which is which! ie: turn shell on and leave IP off.
    I tried that...doesn't work.

  6. #6
    Join Date
    Dec 2004
    Posts
    30
    I made a little mistake: Email Lists should be $value[8].

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •