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!

xml-api reseller

Discussion in 'cPanel Developers' started by eugui, May 20, 2008.

  1. eugui

    eugui Member

    Dec 10, 2007
    Likes Received:
    Trophy Points:
    Marília, SP, Brazil

    I'm using the cpanel xml-api and i need to suspend some reseller accounts and i want to know if this s right because don't have xml-api command to suspend a reseller:

    - get the reseller account
    - get total of clients of the reseller
    - do a loop using total of clientes and get the clients user
    - suspend an account using the xml-api

    for example:

    $status = whmResellerStats($reg['servidor_ip'], $reg['whm_login'], $reg3['whm_key'], $reg3['dominio_login']);

    /* Total Clientes */

    $total = sizeof($status['resellerstats']['result'][0]['accts']);

    /* Percorre o vetor buscando todos os login da revenda */

    for($w = 0;$w < $total; $w++)
    /* pega o login do dominio */

    $login = $status['resellerstats']['result'][0]['accts'][$w]['user'];

    /* Com o login, eh feita a suspensao */

    $susp = whmSuspendAccount($reg3['servidor_ip'], $reg3['servidor_whm_login'], $reg3['servidor_whm_key'], $login, $motivo);

    /* Verifica se a suspensao deu certo */
    if($susp['suspendacct']['result'][0]['status'] == 1)
    $retorno[$i]['suspendido'] = 'Y';
    } else {
    $retorno[$i]['suspendido'] = 'Erro';

  2. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Dec 28, 2001
    Likes Received:
    Trophy Points:
    Without seeing all the code as to what functions you're calling I cant say if it's right but the logic is correct.

    I would first call this to get all the reseller's accounts:


    Then from that data, you have the username of each account owned by the reseller.

    You can then loop through all the usernames (mid you I'm a perl guy):

    foreach my $username (%usernames){       

    Noting that I haven't specified how to call the XML API above. I usually do it with Net::SSLeay on Perl.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice