Web Hosting Talk







View Full Version : cPanel API Scripting


snotek
09-22-2009, 03:52 PM
I'm currently hosting using WHM/cPanel through Servint.net and I'm trying to create a simplified control panel for my customers. What I'm looking to do seems simple yet I can find NO examples or ready-made scripts online.

I need a way to retrieve a users Disk Space Limit and Usage, as well as their Bandwidth Limit and Usage without logging into cPanel directly.

It would appear that there is an API that would allow this, but I'm not a programmer myself and as stated above cannot find anything that's already written to achieve this. Surely this isn't a difficult task?

My preference is to use PHP to access and retrieve the stats in real time when the user accesses a page in my control panel.

Can anyone assist or point me in the right direction?

markosolo
09-22-2009, 06:30 PM
WHMCS shows that information so I'm sure it's possible, I believe it's pretty easy to program with cPanel's API just there isn't really an examples at all. I think you might have to be the first!

cselzer
09-22-2009, 06:38 PM
found a couple php classes...

http://www.phpclasses.org/browse/package/3534.html
http://phpclasses.ranchoweb.com/browse/file/20658.html

AdelaideHost
09-22-2009, 07:37 PM
I've just started looking into this for a new project of mine and it's definitely not as straight forward and easy as I'd like (nothing ever is! :D)
Nevertheless, I've found that the cPanel website and forums has a bit of information. For starters, check the XMLAPI PHP class:
http://forums.cpanel.net/f42/xmlapi-php-class-111897.html
and then the wiki (http://twiki.cpanel.net/twiki/bin/view/DevHooks/ScriptHooks#PHP).

It seems like you can perform most functions with the API and it's in continuing development so I assume it will only get better. Retrieving user information should be easy enough.

Good luck ;)