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.

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:
    1
    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:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. Valdamoon

    Valdamoon Registered

    Joined:
    Feb 10, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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:
    14,447
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  5. BlaineM.

    BlaineM. cPanel QA Analyst
    Staff Member

    Joined:
    Apr 4, 2011
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    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:
    1
    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:
    6
    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:
    1
    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