TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   How to access functions of Cpanel? (http://www.talkphp.com/absolute-beginners/91-how-access-functions-cpanel.html)

jaswinder_rana 07-15-2005 01:45 PM

How to access functions of Cpanel!
 
Hi,
this is not a question, as you might have thought, but a little insight into how to automatically access functions of Capanel, like creating accounts and accessing accounts.

Cpanel has script(on some servers its class, mainly new ones), which is here
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
on some servers it is Account-class.php.inc, if its a class.

you include this and set up host name and user and access hash for WHM and then you can use any function.
if the file is simple like its not a class. then the following will do
PHP Code:

<?php

require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
$host "localhost";
$user "";
$accesshash '';

$accts listaccts($host,$user,$accesshash,0);
print_r($accts);
?>

and if its a class then following would do
PHP Code:

$obj = new accounting();
$obj->host 'localhost';
$obj->user 'root';
$obj->accesshash 'cbff2cf02a6e55b04c9a0eb5d67a6b14
.................................................
75dc188960bb2a008821b34fddf95c02'
;
$accts $obj->listaccts();
print_r($accts); 

So, both above written scripts will list all the domains hosted on that server.
the only difference is the second one is class based.

hope this helps somebody

AlEast 07-15-2005 02:54 PM

What versions contain the class file? And is it one or the other or both? If you know, just found it interesting as I wasn't aware of the class.

jaswinder_rana 07-15-2005 02:56 PM

Not sure, but the one i used (which had class) is,
WHM 10.1.0 cPanel 10.2.0-R82
CentOS 3.5 i686 - WHM X v3.1.0

AlEast 07-15-2005 05:53 PM

Ok thanks.


All times are GMT. The time now is 12:44 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0