Reputation: 2249
I'm working on a WHM API and want to find the cPanel username by passing the domain name.
NOTE: I've the credentials of WHM.
There is no such documentation exists here https://documentation.cpanel.net/pages/viewpage.action?pageId=1507786
So, is there a way to achieve do so?
Update:
Now, I'm using xmlapi.php and here is what I tried so far.
require_once(base_path() . "/vendor/cpanel_api/xmlapi.php");
$ip = env('SERVER_IP', "127.0.0.1"); //your server's IP
$xmlapi = new \xmlapi($ip);
$xmlapi->password_auth(env('CPANEL_USER', "root"),env('CPANEL_PASSWORD', "")); //the server login info for the user you want to create the emails under
$xmlapi->set_output('json');
$xmlapi->set_debug(1);
$params = array('domain'=>$domain, 'searchtype'=>'domain'); //quota is in MB
$res = json_decode($xmlapi->api2_query('root', "listaccts", "", $params), true);
print_r($res);
in $xmlapi->api2_query
method, there are 4 arguments
I have to find out the cPanel Username, so, I wrote the 'root' for now. but no success
Upvotes: 0
Views: 1705
Reputation: 2540
Please give a try with cPanel API.
Here are the some useful docs of API.
https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+2 https://documentation.cpanel.net/display/SDK/Guide+to+WHM+API+1
Upvotes: 0