MPCpanel ¶
Class to access cpanel apis
It accepts any function of xml/json api, also cpanel api1 and api2
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));
cpanel Getting exception
I am getting exception when i am try to include MPCpanel file into component 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 ),
I am also try to import file which is available in extensions folder
'import'=>array( 'application.models.', 'application.components.', 'application.extensions.MPCpanel', ),
I am getting the error message CException Property "CWebUser.cpanel" is not defined. Please help me I am new in Yii Thank in advance
@Ashish Gupta
you wrote
which is not avaliable
try
and you will do fine
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.