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.

Retrieve doc root for domain

Discussion in 'cPanel Developers' started by Sindre, Nov 2, 2008.

  1. Sindre

    Sindre Well-Known Member

    Joined:
    Aug 25, 2008
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    I am working on a custom plugin for cPanel and need to retrieve the doc root based on the domain selected in a dropdown list.

    After looking through the source of the cPanel core files, I found out how it is done in the File Manager popup:

    Code:
    cpanel_api2(docrootcallback,'DomainLookup','getdocroot','domain',domain);
    I have got it to work using javascript, but I would like to use the same call using <?cp ?> tags for better compatibility.

    I tried the following to no avail:

    Code:
    <?cp DomainLookup::getdocroot(%,domain) domain='mydomain' ?>
    I can't find this module or function in the API docs so I don't really know the name of the return variable.

    Does anyone have a clue how to accomplish this? Also, I find the API docs very limited. Seems like a lot of functions are missing?!
     
  2. Sindre

    Sindre Well-Known Member

    Joined:
    Aug 25, 2008
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    I have solved this.

    If anyone is interested in the solution, here it is:

    Code:
    /xml-api/cpanel/?xmlin=<cpanelaction><apiversion>2</apiversion><module>DomainLookup</module><func>getdocroot</func><args><domain>yourdomain.com</domain></args></cpanelaction>
    
    By the way, is there a place where all the API functions are listed, or are we supposed to find them ourself by looking at the source code? A complete API doc would be great.
     
Loading...

Share This Page