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.

Hello API

Discussion in 'cPanel Developers' started by isandell, Jul 14, 2009.

  1. isandell

    isandell Member

    Joined:
    Jul 12, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I have been really struggling with APIs. I have so far been unable to get anything and I still don't have a clue about how to call them. I have found the cPanel documentation little help.

    I think that what I need is the API equivalent of "Hello world" - a very simple url, php procedural script etc to output something, anything.

    Can some kind soul provide such a basic bit of code please?
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If your preferred programming language is PHP 5, you may want to use Matt's PHP 5 class for our APIs as it includes many of these small "hello world" type of code samples. You can find this code archive at:

    http://forums.cpanel.net/f42/xmlapi-php-class-111897.html

    If you prefer to use another programming language, let me know and I'll see what I can get put together for you.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    ** Moved thread to Developer Corner **
     
  4. isandell

    isandell Member

    Joined:
    Jul 12, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I think that we are talking at cross-purposes. The APIXML class is 400 lines of code. I can get nothing to work with this, zilch, zero, nought - just loads of error messages.

    That's why I asked for just a few line of code, dont mind if it's PHP, Perl or Sinclair basic. Just something that I can run for produce some output other than error statements.

    Ok, I give up now. Thanks for your help but I now realise that I am destined not to understand and be able to use cP APIs.

    I have some code the works for now. It may stop working in the future (I suspect some years in the future) so may revisit if and when that happens.

    Thanks for your time

    A disappointed Ian
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Can you select one code sample that you were unable to get working and share the errors you encountered so I can have the opportunity to assist you?
     
  6. isandell

    isandell Member

    Joined:
    Jul 12, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    This is typical. I have replacement my real username in the attached file with "username".
     

    Attached Files:

  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In the scenario noted in the text file you attached, what happened is you did not successfully authenticate into cPanel or WHM (whichever you were attempting to log into). As a result the XML parser was trying to process HTML and that led to a long list of errors.
     
  8. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    What version of cPanel are you running? That class can have issues with some of the new security functions that exist in EDGE. I should be releasing an updated version in not too much longer.
     
  9. isandell

    isandell Member

    Joined:
    Jul 12, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Version 11.24.4-STABLE
     
Loading...

Share This Page