isandell

Member
Jul 12, 2009
11
0
51
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?
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
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?
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.
 

isandell

Member
Jul 12, 2009
11
0
51
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
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
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
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?
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
This is typical. I have replacement my real username in the attached file with "username".
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.
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
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.