3

I am using cpanel xml api.

https://github.com/CpanelInc/xmlapi-php

i can create subdomains and delete them.

Now i want to list the subdomains.

Here is the Answer in API1 level

$listSubdomain = $xml->api1_query( $cp_un, 'SubDomain', 'listsubdomainsop');

$listSubdomainpaths = $xml->api1_query( $cp_un, 'SubDomain', 'cplistsubdomains');

1 Answers1

0

You can use the following:

$subdomainsList = $xml->api2_query($cpanelUser, 'SubDomain', 'listsubdomains');

If you want, it is possible to filter results using a PCRE regex:

$subdomainsList = $xml->api2_query($cpanelUser, 'SubDomain', 'listsubdomains', [
    'regex' => '\bMySubdomain\b'
]);
Marcio Mazzucato
  • 8,841
  • 9
  • 64
  • 79