I'm currently working with XMLAPI in PHP with cPanel to automatically create subdomains for my customers. I've managed to create the script that allows for subdomain creation but I'm having a hard time wrapping my head around using XMLAPI to issue certificates using the LetsEncrypt certificate issuer inside cPanel. Here is the script I use to create subdomains:
$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 . '/'));
and here is what I'm trying to use to issue certificates:
$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, ''));