Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Create Add-On Domain through a script?

Discussion in 'General Discussion' started by azz0r, Apr 22, 2008.

  1. azz0r

    azz0r Registered

    Apr 22, 2008
    Likes Received:
    Trophy Points:

    My boss has set me the task of creating a form that auto-generated an add-on domain.

    What I was wondering, is there away to somehow using PHP auto generate this task?

    I figured the servers using cPanel so there might be a way to trigger the behaviour in Cpanel via a PHP command.

    Any help grealy appreciated :)

    - Aaron
  2. brianoz

    brianoz Well-Known Member

    Mar 13, 2004
    Likes Received:
    Trophy Points:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    One basic method is to simulate a cpanel web client by submitting to the cpanel server as if you were a web browser with a user creating addon domains.

    Otherwise, you could write stuff running as root to fiddle with the configuration files, but I'm not sure which files exactly are required.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Nov 29, 2006
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I recommend calling the appropriate API to generate the add-on domain for the cPanel account. This API is actually cPanel's API2 which can be triggered via our XML-API that can be used through any language that supports XML and HTTP/S, such as PHP.

    Determining the API you need to call is very easy. First, navigate to the page where you can add a domain within the X3 theme. Note the path in the URL bar starting with frontend/x3/

    Now login to the server as root via SSH and navigate to /usr/local/cpanel/base/frontend/x3. The path after the frontend/x3/ in your address bar indicates the file you should look at for the source code. The source code is very easy to read (It's just cPanel API calls embedded in some CSS, HTML and Yahoo UI code.). Find the API the X3 interface calls and use that!

    Instructions for using API1 and API2 calls from the XML-API can be found on our website at:

    I'll also be covering some of this in my advanced branding presentation at this year's conference if you want to come:

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice