Reputation: 31
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');
Upvotes: 3
Views: 1029
Reputation: 9305
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'
]);
Upvotes: 0