I'm working on some scripts to manage the [cpanel] accounts directly from PHP (Scripts will be GNU/GPL licensed).
After STFW, I've not found any good documentation on it, just the short samples on http://www.cpanel.net/remoteaccess-php.html
I haven't found anything more detailed on their site. I just ended up looking at the scripts themselves. They are just wrappers around the scripts that are part of the cpanel installation. If you find more documentation, I'd love to know about it.
At this moment, I have access to some servers with the accounting libs installed, but I have no access to the fonts (Which could help to make it work).
I didn't have to do anything with the fonts. What problems are you having?
If anyone can post a link where to find good docs about this cpanel lib, and, if possible the source code for it, it will help me so much.
Here's a snippet:
# cpanel idiotically outputs html rather than
# programmatically-useful error codes. Thus, we have to manipluate
# the output before and after calling cpanel function.
flush();
ob_start();
# You can get the $cpkey from the WHM. The rest are yours to fill in.
createacct( "localhost", "root", $cpkey, 0, $domain, $acctuser, $acctpass, "packagename" );
ob_end_clean();
# Now we check after the fact to see if account was created. # This is a VERY WEAK test, needs improvement.
$accounts = listaccts( "localhost", "root", $cpkey , 0); $keys = array_keys( $accounts ); $account_found = NULL; for( $i = 0; $i < count( $keys ); $i++ ) { if( in_array( $domain, $accounts[$keys[$i]] ) ) { $account_found = TRUE; break; } }
There are a few gotchas with this API. For one thing, createacct() always returns the string "Account Creation Complete" no matter if the account was created or not. You have to verify the creation some other way.
For another thing, the createacct() function writes directly to the output stream. So all of the stuff you see when you create an account the normal way (using the Cpanel web interface) will be displayed unless you stop it. That's what the flush() and the ob_* stuff does.
If you find more information, that would be great. We can trade notes.
cheers,
Travis
-- Travis Low <mailto:[EMAIL PROTECTED]> <http://www.dawnstar.com>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php