Nested subdomain Creation
I need to create sub-subdomain; something like sub.subdomain.maindomain.com
Am getting the sub under maindomain.com, so the result is sub.maindomain.com instead of sub.subdomain.maindomain.com. Anyone knows how to make it? Thanks in advance
$cpanelHost = "subdomain.maindomain.com";
$xmlapi = new xmlapi($cpanelHost);
$xmlapi->password_auth($cpanelUsername,$cpanelPassword);
$xmlapi->set_debug(1);
$xmlapi->set_output('array');
$xmlapi->set_port($cpanelPort);
$addsub = $xmlapi->api2_query($cpanelUsername,"SubDomain","addsubdomain",array("rootdomain"=>$cpanelHost,"domain"=>"sub", "dir" => "/public_html/sub"));
Am getting the sub under maindomain.com, so the result is sub.maindomain.com instead of sub.subdomain.maindomain.com. Anyone knows how to make it? Thanks in advance
-
Anyone know how to create sub2.sub1.domain.com using XMLapi? where sub1 is an A record (a new account) under the main domain. 0 -
Hello :) Please ensure you follow the guidelines for this function: API2 Function - addsubdomain I tested with the following JSON-API call and it worked well: /json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SubDomain&cpanel_jsonapi_func=addsubdomain&domain=test1.test2&rootdomain=cptesting.com
Notice how "test1.test2" is used for the "domain" parameter without the root domain name. Thank you.0 -
Thank you Michael, It's clear now I should use Domain:test1.dev Rootdomain:maindomain.com and not Domain:test1 Rootdomain:dev.maindomain.com Thanks a lot, But when I used it, I got this message: Array ( [apiversion] => 2 [data] => Array ( [reason] => The domain "dev.worksitesimple.com"" does not exist. [result] => 0 ) [error] => The domain "dev.worksitesimple.com"" does not exist. [event] => Array ( [result] => 1 ) [func] => addsubdomain [module] => SubDomain )0 -
Could you post the code you are using for the creation? Note that you can enable the "API Shell" option in cPanel to make sure you are using the correct parameters: API Shell Thank you. 0 -
Hi Michael, Thank you for your help, I really appreciate it, here you go the code am using password_auth("".$cpanelUsername."","".$cpanelPassword.""); $xmlapi->set_debug(1); $xmlapi->set_output('array'); $xmlapi->set_port($cpanelPort); $addsub = $xmlapi->api2_query($cpanelUsername, "SubDomain", "addsubdomain", array( "rootdomain"=>$cpanelHost, "domain"=>"dev3.dev", "dir" => "/public_html/dev3" )); print_r($addsub); ?>
Where I've already a new account called dev.maindomain.com, this created a DNS zone automatically. Thanks Robert0 -
It's working normally right now after updating the "domain" and $cpanelUsername variables.. I used the root username to authenticate, but the account user name to create the subdomain. Robert 0 -
I am happy to see you were able to address the issue. Thank you for updating us with the outcome. Thank you. 0
Please sign in to leave a comment.
Comments
7 comments