2016-02-29 55 views
0

我正在使用WHM API,並希望通過傳遞域名來查找cPanel用戶名。WHM API:按域名查找cPanel用戶

備註:我有WHM的憑據。

這裏沒有這樣的文件存在https://documentation.cpanel.net/pages/viewpage.action?pageId=1507786

那麼,有沒有辦法實現這樣做呢?

更新:

現在,我使用xmlapi.php這裏是我試過至今。在$xmlapi->api2_query方法

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

,有4個參數

  • 的cPanel用戶名
  • WHM模塊名稱
  • 在步驟給定的模塊下作用2
  • 參數,那將被傳遞到步驟3中的功能

我必須找出cPanel用戶名,所以,我現在寫了'root'。但沒有成功

回答