Hello, I would like to use the cPanel/WHM API.
I would like a script which makes a database, then makes the user and adds the user with all permissions.
Thanks a lot, it would be easier if I could do this through my WHM hash.
Hello, I would like to use the cPanel/WHM API.
I would like a script which makes a database, then makes the user and adds the user with all permissions.
Thanks a lot, it would be easier if I could do this through my WHM hash.
Have you had a peek at the cPanel Developers Blog? That would probably be a great place to get started. Also this very forum section you've posted to has lots of threads you might find some use from.
HTH!
Search this developer forum specifically for the words create database I think what you seek can be found in those results.
We do have a PHP class specifically for performing functions through the XML-API, called the XML-API PHP Class.
There are specific examples of usage in the Examples directory which can be manipulated for different functions. Also, there are quite a few threads here on the forum explaining how to change them.
The scripts in the Examples directory and also here in the forums are probably the closest you'll come to finding a pre-built script, aside from someone building you one.
Last edited by cPanelBlaine; 02-10-2012 at 12:34 PM. Reason: typo and grammer (should have proofread)
Okay, thanks guys.
Okay, I got some script which works, however it seems to create the database and user.
Here is what sort of code is going in:
Outputs:print_r ($xmlapi->api1_query("acctest", "Mysql", "adduserdb", array("acctest_db", "acctest_user", 'all')));
When I try to do a query using mysql_query:Array ( [module] => Mysql [func] => adduserdb [type] => event [source] => internal [apiversion] => 1 [data] => Array ( [result] => You do not have access to that database (acctest_user)! ) [event] => Array ( [result] => 1 ) [postevent] => Array ( [result] => 1 ) [preevent] => Array ( [result] => 1 ) )
Thanks.No database selected
Last edited by Valdamoon; 02-10-2012 at 01:11 PM.
Well, it looks like your query is built in the correct order; $user, $module, $function, $args
but the output looks like its saying your array isn't correct.
Would you mind pasting in the script you're using?
Never mind I fixed it, it was not to do with that, it was something I was messing up before I called that.
Thanks for all the help, problem solved!![]()