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!

How do I use the cPanel/WHM API?

Discussion in 'cPanel Developers' started by Valdamoon, Feb 10, 2012.

  1. Valdamoon

    Valdamoon Registered

    Joined:
    Feb 10, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Reseller Owner
    Hello, I would like to use the cPanel/WHM API.

    I would like a script which makes a database, then makes the user and adds the user with all permissions.

    Thanks a lot, it would be easier if I could do this through my WHM hash.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,459
    Likes Received:
    418
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Valdamoon

    Valdamoon Registered

    Joined:
    Feb 10, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Reseller Owner
    Okay, thanks, but I have checked that, and I just can not find what I am looking for.
    It would be easier with either a pre built php script for what I want or a class which allows these to become easy functions.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,459
    Likes Received:
    418
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. BlaineM.

    BlaineM. cPanel QA Analyst
    Staff Member

    Joined:
    Apr 4, 2011
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    We do have a PHP class specifically for performing functions through the XML-API, called the XML-API PHP Class.

    There are specific examples of usage in the Examples directory which can be manipulated for different functions. Also, there are quite a few threads here on the forum explaining how to change them.

    The scripts in the Examples directory and also here in the forums are probably the closest you'll come to finding a pre-built script, aside from someone building you one.
     
    #5 BlaineM., Feb 10, 2012
    Last edited: Feb 10, 2012
  6. Valdamoon

    Valdamoon Registered

    Joined:
    Feb 10, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Reseller Owner
    Okay, thanks guys.
    Okay, I got some script which works, however it seems to create the database and user.
    Here is what sort of code is going in:
    Outputs:
    When I try to do a query using mysql_query:
    Thanks.
     
    #6 Valdamoon, Feb 10, 2012
    Last edited: Feb 10, 2012
  7. BlaineM.

    BlaineM. cPanel QA Analyst
    Staff Member

    Joined:
    Apr 4, 2011
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Well, it looks like your query is built in the correct order; $user, $module, $function, $args
    but the output looks like its saying your array isn't correct.

    Would you mind pasting in the script you're using?
     
  8. Valdamoon

    Valdamoon Registered

    Joined:
    Feb 10, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Reseller Owner
    Never mind I fixed it, it was not to do with that, it was something I was messing up before I called that.
    Thanks for all the help, problem solved! :D
     
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