Child pages
  • cPanel API 1 Functions - SubDomain::addsubdomain

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function adds a subdomain to a domain.

Warning
titleWarning:

Include Page
LIB:_cPanelAPI1NewerFunctions
LIB:_cPanelAPI1NewerFunctions

  • UAPI (recommended)None.
  • cPanel API 2SubDomain::addsubdomain
    Excerpt Include
    cPanel API 2 Functions - SubDomain::addsubdomain
    cPanel API 2 Functions - SubDomain::addsubdomain
    nopaneltrue
Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleLiveAPI PHP Class
Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$add_domain = $cpanel->api1('SubDomain','addsubdomain', array('subdomain','example.com','0','1','public_html/subdomain') ); // Call the function.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

Expand
titleLiveAPI Perl Module
Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_domain = $cpliveapi->api1('SubDomain','addsubdomain', ['subdomain','example.com','0','1','public_html/subdomain'] ); # Call the function.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 

Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

Code Block
languagetext
<cpanel Module="SubDomain::addsubdomain( $FORM('domain','rootdomain','canoff','disallowdot','dir') )">
Expand
titleCommand Line
Code Block
languagebash
cpapi1 --user=username SubDomain addsubdomain subdomain example.com 0 1 public_html/subdomain

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote

Expand
titleOutput (plaintext)
Code Block
languagexml
The subdomain "subdomain.example.com" has been added.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
domain

string

Required

The subdomain to add.

A valid subdomain string.subdomain
rootdomainstring

Required

The domain name.

A valid domain name.example.com
canoffBoolean

Whether to create a wildcard subdomain.

This value defaults to 0.

  • 1 — Create a wildcard subdomain.
  • 0 — Create a normal subdomain.
0
disallowdotBoolean

Whether to strip the dots from the domain parameter.

This value defaults to 0.

  • 1 — Strip all dots.
  • 0 — Strip only the trailing dot.
1
dirstring

The path to the subdomain's document root, relative to the account's home directory.

This value defaults to public_html.

A valid relative path.
public_html/subdomain

Returns

This function returns a confirmation message.