【发布时间】:2016-06-12 09:06:07
【问题描述】:
我正在开发 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个参数
- cPanel 用户名
- WHM 模块名称
- 步骤 2 中给定模块下的函数
- 参数,将在步骤 3 中传递给函数
我必须找出 cPanel 用户名,所以,我现在写了“root”。但没有成功
【问题讨论】: