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!

Help getting to Add a new Addon domain via PHP

Discussion in 'cPanel Developers' started by alexmichaelis, Apr 16, 2011.

  1. alexmichaelis

    alexmichaelis Registered

    Joined:
    Apr 16, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    Hello,

    I want to allow my users to define an addon domain for their websites using a form. I have a VPS server with Cpanel, WHM and I am trying to create a PHP script that will just create this new addon domain in a seamless way to the user. So I am using CURL to authenticate and call the following URL (this is just an example):

    https://localhost:2083/xml-api/cpanel?cpanel_xmlapi_module=AddonDomain&cpanel_xmlapi_func=addaddondomain &cpanel_xmlapi_version=2&dir=<my_dir_editted_for_security>&newdomain=test.com&subdomain=alex.test.com

    However, I always get the same response: "Sorry, a main domain was not specified".

    Can someone please help me?

    Thank you!
    Alex
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    3
    Trophy Points:
    68
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Alex,

    I tried the following URL and it worked for me:
    Code:
    https://10.1.1.1:2083/xml-api/cpanel?cpanel_xmlapi_version=2&cpanel_xmlapi_module=AddonDomain&cpanel_xmlapi_func=addaddondomain&newdomain=alex.net&subdomain=alex.dave.com&dir=alex
    
    Are you authenticating your call as the user? (in my case it's "dave", how owns "dave.com"; in your case it would be the user who owns "alex.com"). If you authenticating as 'root', then you should use port 2087 and also provide the URL parameter "cpanel_xmlapi_user=$cpuser".

    Regards,
    -DavidN
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    3
    Trophy Points:
    68
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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