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.

XML-API and controling WHM using remote Perl script - Help!

Discussion in 'cPanel Developers' started by jonathanwww, Jun 29, 2008.

  1. jonathanwww

    jonathanwww Registered

    Joined:
    Jun 29, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I am able to get the XML API to work when I log in manually to the WHM, and execute the /xml-api/command_name?key1=value&key2=value,

    But what I am really trying to do is to write a remote perl script that access XML API on the WHM server. This will allow me to automate the creation process using my remote server.

    Can you give me an example of how this can be done via NET::SSLEAY Post?

    How does the XML API authenticate who can give it commands?

    Do I have to provide a remote access key and how as the input argument?

    I'm trying to change bandwidth limits: Am I missing some keys?

    use Net::SSLeay qw(post_https make_form make_headers);

    my($page, $response, %HEADERS) = post_https($my_server_host_name, 2087, "/xml-api/limitbw",

    make_form(
    user => $account_user,
    bwlimit => '1000',
    )

    );

    Don't I have to specify a Remote Access Key for that command to work?
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The whmreq method in /usr/local/cpanel/Cpanel/Accounting.pm should point you in the right direction.
     
Loading...

Share This Page