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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

find user's addon domain and subdomain folder path

Discussion in 'cPanel Developers' started by tecwithquestion, Sep 11, 2017.

Tags:
  1. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    56
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello

    Can someone help to find users addon dominn path and subdomain path using cpanel uapi ?

    I tried to use documentation link but I am unable to find exact code.

    Thank you.
     
  2. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    562
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    56
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Thank you !

    How can I get result using

    <?php

    include("/usr/local/cpanel/php/cpanel.php"); // Instantiate the CPANEL object.

    $cpanel = new CPANEL(); // Connect to cPanel - only do this once.

    print $cpanel->header( "Path" ); // Add the header.
    $list_addons = $cpanel->api2(
    'AddonDomain', 'listaddondomains',
    array(
    'dir' => 'domain',
    )
    );
    echo $list_addons ;
    <?php

    print $cpanel->footer(); // Add the footer.

    $cpanel->end(); // Disconnect from cPanel - only do this once.

    ?>

    IS this the correct way to use code?

    Please correct me if I am wong
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,080
    Likes Received:
    1,364
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You'd need to adjust this line to output more useful information. Here's the link we provided in our plugin developers mailing list for anyone else browsing this thread with a similiar question:

    What's the difference between echo, print, and print_r in PHP?

    Thank you.
     
Loading...

Share This Page