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.

delete directory via cpanel api

Discussion in 'cPanel Developers' started by gigamike, Sep 30, 2011.

  1. gigamike

    gigamike Member

    Joined:
    Jan 14, 2008
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    We do not provide support for that class within this forum.

    You would probably want to use the xml-api class (see: github.com/CpanelInc) and the Fileman::fileop API2 functoin (ApiFileman < ApiDocs/Api2 < TWiki) using the "unlink" action.
     
  3. gigamike

    gigamike Member

    Joined:
    Jan 14, 2008
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hi Matt,

    Many thanks for the help, it works.

    I hope this may help others, using the xmlapi.php

    $xmlapi = new xmlapi('x.x.x.x');
    $xmlapi->password_auth('root', 'password');
    $xmlapi->set_debug(1);

    // create sub domain
    $xmlapi->api1_query($username, 'SubDomain', 'addsubdomain', array($subDomain, $domaindomain, 0, 0, '/public_html/subdomain.domain'));

    // create FTP account
    $xmlapi->api1_query($username, 'Ftp', 'addftp', array($ftpUsername, $ftpPassword, $subDomain.".".$domain, $ftpQuotaMb));

    // you can use PHP: FTP - Manual to upload automatically via script on the created subdomain directory i.e. index page, htaccess

    // delete files
    $xmlapi->api2_query($username, "Fileman", "fileop", array("op"=>"unlink", "sourcefiles"=>''/public_html/subdomain.domain'));

    // delete FTP account
    $xmlapi->api1_query($username, 'Ftp', 'delftp', array($subDomain));

    // delete sub domain
    $xmlapi->api1_query($username, 'SubDomain', 'delsubdomain', array($subDomain, $domain, 0, 0, ''/public_html/subdomain.domain''));

    Thanks again,

    Mike
     
  4. massagenvy

    massagenvy Registered

    Joined:
    Sep 29, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    good tips. Thanks
     
Loading...

Share This Page