Languages :: PHP :: Passing functions via PHP |
|||
| By: MirageSF |
Date: 09/11/2004 00:00:00 |
Points: 250 | Status: Answered Quality : Excellent |
|
Hi, How do I pass the createacct function using the following information, to get it to create an account ? The Cpanel Accounting php module is designed to give programs that need access to create/remove/modify accounts an easy way to implement this in their php program. The general syntax for calling these functions is: function_name ($host,$user,$accesshash,$usessl,$args); Example: createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan); For security reasons if you are connecting to a remote server you should set the usessl argument to 1. You must have the curl+ssl module installed for this to work. Cpanel Accounting supports the following methods showversion Shows what version of WHM the remote server is running. listaccts Lists currently active accounts. listpkgs Lists packages avalible for creation. createacct Creates a new account on the server. killacct Terminates an account on the server. suspend Suspends an account on the server. unsuspend Unsuspends an account on the server. Below is a sample php program. #!/usr/local/cpanel/3rdparty/bin/php <?php require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "localhost"; $user = "<USERNAME HERE>"; $accesshash = '<REMOTE ACCESS KEY HERE>'; $accts = listaccts($host,$user,$accesshash,0); print_r($accts); $pkgs = listpkgs($host,$user,$accesshash,0); print_r($pkgs); ?> Cheers |
|||
| By: VGR | Date: 10/11/2004 05:54:00 | Type : Answer |
|
| understood nothing, but use echo '<pre>'; print_r(); echo '</pre>'; or it won't work |
|||
| By: Diggie | Date: 10/11/2004 19:27:00 | Type : Assist |
|
| <?php // cpanel settings require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "localhost"; $user = "<USERNAME HERE>"; $accesshash = '<REMOTE ACCESS KEY HERE>'; // new account $acctdomain = 'my_domain'; $acctuser = 'test-user'; $acctpass = 'secret'; $acctplan = 'unknown'; // see Accounting.php.inc what should be in here // create the account createacct ($host, $user, $accesshash, $usessl, $acctdomain, $acctuser, $acctpass, $acctplan); // check accounts $accts = listaccts($host,$user,$accesshash,0); var_dump($accts); ?> |
|||
| By: Diggie | Date: 10/11/2004 19:29:00 | Type : Comment |
|
| try to login to the support forum on cpanel.net there is a topic about new users; maybe interesting |
|||
| By: sweet_aris08 | Date: 06/07/2009 15:25:34 | Type : Comment |
|
| <?php require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "localhost"; $user = "<USERNAME HERE>"; $accesshash = '<REMOTE ACCESS KEY HERE>'; $accts = listaccts($host,$user,$accesshash,0); print_r($accts); $pkgs = listpkgs($host,$user,$accesshash,0); print_r($pkgs); ?> Cheers By: VGR Date: 10/11/2004 06:54:00 English Type : Answer understood nothing, but use echo '<pre>'; print_r(); echo '</pre>'; or it won't work By: Diggie Date: 10/11/2004 20:27:00 English Type : Assist <?php // cpanel settings require '/usr/local/cpanel/Cpanel/Accounting.php.inc'; $host = "localhost"; $user = "<USERNAME HERE>"; $accesshash = '<REMOTE ACCESS KEY HERE>'; // new account $acctdomain = 'my_domain'; $acctuser = 'test-user'; $acctpass = 'secret'; $acctplan = 'unknown'; // see Accounting.php.inc what should be in here // create the account createacct ($host, $user, $accesshash, $usessl, $acctdomain, $acctuser, $acctpass, $acctplan); // check accounts $accts = listaccts($host,$user,$accesshash,0); var_dump($accts); ?> |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








