The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Create Add-On Domain through a script?

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

  1. azz0r

    azz0r Registered

    Joined:
    Apr 22, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello.

    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

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    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.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    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:

    http://www.cPanel.net/plugins/xmlapi

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

Share This Page