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.

whm listaccts ans cpsess

Discussion in 'cPanel Developers' started by firexit, Dec 13, 2010.

  1. firexit

    firexit Active Member

    Joined:
    Nov 4, 2004
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    8
    whm listaccts and cpsess

    i used curl in the past to login to my whm and parse the links to the cpanel accounts from the whm "list accounts"
    this doesnt work with cpsess.

    i really need some help here

    is there any way to pass that cpsess to curl? i ddint find any way to catch it or maybe somehow with xmlapi?


    thanks
     
    #1 firexit, Dec 13, 2010
    Last edited: Dec 13, 2010
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In most cases, if you code against the xmlapi, then you don't have to worry about the cpsess. That is, authenication happens with each request and is done via the HTTP header.

    Take a look at ApiAuthentication < AllDocumentation/AutomationIntegration < TWiki . You should be able to see how you can modify your script to use the authentication in the header. The examples there show how you would do it with Perl's LWP agent or with PHP's cURL functions. But, regardless, the principle is the same and should translate to the CLI agent of cURL, or whatever script language you're using against the cURL libraries.

    If you're coding PHP, I'd suggest just using our XML-API PHP client class. It's easy to use. There are examples in the tarball: http://sdk.cpanel.net/lib/xmlapi/php/cp_xmlapi_php_v1.0.7.tar.gz

    Regards,
    -DavidN
     
  3. firexit

    firexit Active Member

    Joined:
    Nov 4, 2004
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    8
    thanks a lot. very good tar, usable examples.
    is there any place where i can find api functions details supported by the whm?


    for now i have found that cpsess wasnt the problem, i got locked out for fault access when playing with the script. so now i modified the script to parse the cpanel links to all accounts with the cpsess but still, doing it with api much better.

    thanks.
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    My signature has many links:
    sdk.cpanel.net is the main landing page for all developer documentation. There's also specific links to the landing page for the API1 and API2 functions (these are used by cPanel itself) and the landing page for the XML-API functions (these represent some of the administrative tasks perform in WHM).

    Glad to hear it's all working for you!

    Regards,
    -David
     
Loading...

Share This Page