PDA

View Full Version : cPanel/WHM Programming.



AntoineBanks
November 12th, 2007, 18:02
Hi.

I'm looking to learn cPanel/WHM CMS programming, but I can't find the tutorials for this. If you know how to do this, please post the tutorials on how to do it, or please lead me to the tutorials. Thanks.

Richard
November 12th, 2007, 20:03
Tutorials?

Well, most of it would be done manually via Curl - as their API is usless.

A tutorial on their API can be seen here: http://www.cpanel.net/remoteaccess-php.html

Mystikk
November 12th, 2007, 20:44
krakjoe - where art thou?

krakjoe
November 13th, 2007, 03:29
WHM can be interacted with by way of standard HTTP requests, some of their functions are equipped to work remotely and some are not, it doesn't matter most of the time as Richard said you can connect to WHM as if you were a browser and carry out operations automatically without too much trouble...

WHM employs it's own authentication method, while it's not required that you use it's "accesshash" it's definate that you should. You use a standard http connection to whm, only instead of


Auth: Basic username:base64encode'dpassword

when you authenticate yourself, you should use


Auth: WHM username:accesshash

this will authenticate you and allow you to call virtually any of WHM's functions as mentioned.

In /usr/local/cpanel/Cpanel/Accounting.inc.php ( or similar ) you will find several examples of interacting with WHM, be warned these examples were written several years ago, and I advise you write your own class to handle whm, you should take note of the curl settings used in that file and in my opinion always use curl where available over using (f)sock(ets) ....

Recently, WHM introduced an XML api, not all servers have this available to them, and some are too old to run it still, you can find a wealth of information on this subject at http://www.cpanel.net/plugins/xmlapi/

JonnyH
November 13th, 2007, 15:43
So joe, what do you use that in the HTML Headers?

krakjoe
November 13th, 2007, 15:47
HTTP headers, yeah ... curl has the CURLOPT_HTTPHEADER option that you can pass arrays of headers to, and fsockets you just write the line after


GET /whatever.script?with=vars HTTP/1.0\n

.... you want a couple of examples maybe, curl and fsockets ??

JonnyH
November 13th, 2007, 16:30
HTTP headers, yeah ... curl has the CURLOPT_HTTPHEADER option that you can pass arrays of headers to, and fsockets you just write the line after


GET /whatever.script?with=vars HTTP/1.0\n

.... you want a couple of examples maybe, curl and fsockets ??
I've still got your old IPB addon. I may try and make my own WHM Host Manager sort of thing.

krakjoe
November 13th, 2007, 16:42
Yeah I dabbled with it a few times, but in the end it's been done to death and I couldn't think of any new ideas, also I'm hindered by my inability to design things that look nice .... I know you can design though and I wish you the best of luck, you're welcome to hit me up for some ( free ) help should you need it ....

JonnyH
November 13th, 2007, 17:59
Thanks for that. Even though I know abit of design, I'm not really going to design it that much. I've just done some basic css bg and got on with the php, so far:
http://kwix-host.com/cpaddon/

krakjoe
November 13th, 2007, 18:34
I get two then header'd to step 1 ?

JonnyH
November 14th, 2007, 11:01
Yeah, aint done it yet. Was about 20mins work :P

JonnyH
November 18th, 2007, 18:12
Just released cP Addon, check here:
http://freewebspace.net/forums/showthread.php?t=2199227