mpcpanel class to access cpanel functions - accepts json xml, cpanel 1 and 2 apis

  1. MPCpanel
  2. Requirements
  3. Install
  4. Usage
  5. Resources

MPCpanel

Class to access cpanel apis

It accepts any function of xml/json api, also cpanel api1 and api2

See it on github

Requirements

Install

put the download file under any imported directory

and in you components config file add the component

return array(
       '...'
       'components'=>array(
            '...',//other components
            'cpanel'=>array(
                   'class'=>'MPCpanel',
                    'username'=>'yourUsername',//required
                    'url'=>'http://mydomain.com:2086/',// by default https://127.0.0.1:2087/
                    'auth_type'=>'basic',//accepted = basic or whm
                                         //basic by default
                    'api_type'=>'json',//accepted = json or xml
                                       //json by default
                    'password'=>'myPassword',//required for basic type of authentication
                    'access_key'=>'myBiggggggggggKey',//required for whm type of authentication
            ),
       ),
    );

Usage

$cpanel=Yii::app()->cpanel;
     
    //will use xml/json api
    $cpanel->listaccts();
     
    //will use xml/json api with parameters
    $cpanel->createacct(array('username'=>'myAccount','domain'=>'mydomain.com','password'=>'myPassword'));
    
    //will use cpanel api1 function webalizer, module Stats, no parameters
    $cpanel->webalizer('Stats');
     
    //will use cpanel api1 function adduserdb, module Mysql using parameters (*api1 parameters must be in order and as string) 
    $cpanel->adduserdb('Mysql','mydbname','mydbuser','all');
     
     //will use cpanel api2 function listwebalizer, module Stats
     //to call api2 make sure the second parameter is array, even if empty
    $cpanel->listwebalizer('Stats',array());
     
    //will use cpanel api2 function change_password, module Passwd using parameters (*api2 parameters must be an array using key/values pairs)
    $cpanel->username='client3';
    $cpanel->password='client3Password';
    $cpanel->change_password('Passwd',array('newpass'=>'m1n3wp4$$w0rd','oldpass'=>$cpanel->password));

Resources

5 0
6 followers
564 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: Gustavo
Created on: Apr 12, 2011
Last updated: 10 years ago

Downloads

show all

Related Extensions