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!

SOLVED How to suspend account using WHM api?

Discussion in 'cPanel Developers' started by hacker2357, Oct 15, 2017.

  1. hacker2357

    hacker2357 Registered

    Joined:
    Oct 15, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Russia
    cPanel Access Level:
    Root Administrator
    I use that library /github.com/mgufrone/cpanel-php. When I call
    Code:
    $cpanel = new Cpanel([
        'host'        =>  '[URL]https://192.168.1.42:2087[/URL]', // ip or domain complete with its protocol and port
        'username'    =>  'root', // username of your server, it usually root.
        'auth_type'   =>  'password', // set 'hash' or 'password'
        'password'    =>  '111111', // long hash or your user's password
    ]);
    
    $result = $cpanel->runQuery('suspendacct', [
        'user' => 'someusr',
        'disallowun' => '1',
    ]);
    
    I get an error "Unknown App Requested for this version (0) of the api: runQuery". How to fix this?
     
    #1 hacker2357, Oct 15, 2017
    Last edited by a moderator: Oct 15, 2017
  2. Muhammed Fasal

    Muhammed Fasal Active Member

    Joined:
    Aug 9, 2017
    Messages:
    40
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPWilliamL

    cPWilliamL cP Technical Analyst II
    Staff Member

    Joined:
    May 15, 2017
    Messages:
    257
    Likes Received:
    29
    Trophy Points:
    103
    Location:
    America
    cPanel Access Level:
    Root Administrator
    Hi,

    As Muhammed pointed out, I would recommend using the whmapi1 to accomplish this. The code you've referenced is 3rd-party and hasn't been updated in 9 months. As well, it seems the error you referenced relates to the last change made to this project back in February of this year.

    Thanks,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    Muhammed Fasal likes this.
Loading...

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