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.

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:
    1
    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/cpan...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:
    1
    Trophy Points:
    18
    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
     
  3. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page