WHM API:按域查找cPanel用户


WHM API: Find cPanel user by domain

我正在开发一个 WHM API,并希望通过传递域名来查找 cPanel 用户名。

注意:我有 WHM 的凭据。

这里没有这样的文档 https://documentation.cpanel.net/pages/viewpage.action?pageId=1507786

那么,有没有办法做到这一点呢?

更新:

现在,我正在使用xmlapi.php这是我到目前为止尝试过的。

    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);

$xmlapi->api2_query方法中,有 4 个参数

  • c面板用户名
  • WHM 模块名称
  • 步骤 2 中给定模块下的函数
  • 参数,将在步骤 3 中传递给函数

我必须找出cPanel用户名,所以,我现在写了"根"。 但没有成功

请尝试使用cPanel API。

以下是一些有用的 API 文档。

https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+2https://documentation.cpanel.net/display/SDK/Guide+to+WHM+API+1