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.

FTP Creation Script

Discussion in 'cPanel Developers' started by valweee, Jan 12, 2012.

  1. valweee

    valweee Registered

    Joined:
    Jan 12, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hi all,
    I just switched over to VPS hosting from shared. I had an old PHP script that would create FTP accounts. It does not work on the new server, which is fine but I can't get the api to work either. I have tried everything, changing ports, trying different usernames, I still get the access denied error.

    Here is an example of just trying to connect generically:
    PHP:
    include("api/xmlapi.php");

    $ip "MYIPADDR";
    $root_pass "mYROOTPASS";

    echo 
    $ip;
    $account "root";
    //have tried using the reseller un/pw, no luck
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root",$root_pass);
    $xmlapi->set_output("xml");
    $xmlapi->set_port(2086);//have tried 2082
    $xmlapi->set_debug(1);
    print 
    $xmlapi->api2_query($account"Email""listpopswithdisk" );
    Each time, I get access denied. Any suggestions?
    Here is a live URL. http://www.elinkswap.com/addFTP2.php

    My host doesn't know what to tell me btw.
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This doesn't work in the API because it doesn't work in the cPanel interface. Just like you cannot login to a cPanel interface with username root, you cannot call API functions for the cPanel interface as username root. $account should be the username of the cPanel account, not root.
     
  3. Demiurg

    Demiurg Member

    Joined:
    Jan 6, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Valwee can you share the old ftp file please, I really need it.
    Thank you!
     
Loading...

Share This Page