我目前正在使用PHP中的XMLAPI和cPanel自动为我的客户创建子域。我设法创建了允许子域创建的脚本,但是我很难使用XMLAPI来使用cPanel内的LetsEncrypt证书颁发者来发布证书。这是我用来创建子域的脚本:
$subdomain = $usrdomain;
$cpanelusr = 'myusername';
$cpanelpass = decryptIt(decryptKey("Jzc5WZO5LfOYonIVSNfgQKmQM0qCiUl7Z3ALKqLI41kpwQQdcGn9kQhjH1k04LImjAgRK8B4Q54DPTyfKLtYXA=="));
$xmlapi = new xmlapi('server ip');
$xmlapi->set_port( 2083 );
$xmlapi->password_auth($cpanelusr,$cpanelpass);
$xmlapi->set_debug(0);
$result = $xmlapi->api1_query($cpanelusr, 'SubDomain', 'addsubdomain', array($subdomain,'mydomain.com',0,0, '/public_html/' . $subdomain . '/'));
以下是我尝试用来颁发证书的内容:
$xmlapi = new xmlapi('server ip');
$xmlapi->set_port( 2083 );
$xmlapi->password_auth($cpanelusr,$cpanelpass);
$xmlapi->set_debug(0);
$result = $xmlapi->api1_query($cpanelusr, 'letsencrypt', 'issue', array($subdomain,'mydomain.com',0,0, ''));