The API example for listaccts is
As a Hello World program, I would like to do the same thing from the bash shell prompt. Say, using a perl script:
$ perl hello.pl
Is there wrapping code to get the API to accept the perl/shell script as root? I am logged in as root, after all.
The shell scripts in /scripts do not have the functions I want, such as cPAddons stuff. So I am trying to use the web API. Really I just want to install Wordpress as a cPAddon without having to use the WHM web interface.
Alternatively, what is the easiest way to get a script like this into the WHM web interface? None of the API examples start that far back at the beginning: where do you put the file and how do you call it.
Code:
https://example.com:2087/xml-api/listaccts?searchtype=user&search=luv
$ perl hello.pl
Code:
#!/usr/bin/perl
BEGIN { unshift @INC, '/usr/local/cpanel'; }
use Whostmgr::Accounts;
use Data::Dumper;
$x= Whostmgr::Accounts::_listaccts();
$_= Dumper($x);
print; # empty since:
$ENV{'REMOTE_USER'}= 'root';
$hasroot = Whostmgr::ACLS::hasroot();
print "hasroot=[$hasroot]\n"; # false
The shell scripts in /scripts do not have the functions I want, such as cPAddons stuff. So I am trying to use the web API. Really I just want to install Wordpress as a cPAddon without having to use the WHM web interface.
Alternatively, what is the easiest way to get a script like this into the WHM web interface? None of the API examples start that far back at the beginning: where do you put the file and how do you call it.