Loldawg

Registered
Sep 16, 2013
2
0
1
cPanel Access Level
Website Owner
Heya,

So I've added a feature to my site which allows for automatic creation of [email protected] whenever a new employee is added. However, the current system I use is using plain text password to login to cPanel, and I was wondering, can I upgrade this? Since it's a commercial system, I'd have to store password in a table, in plain text, which is something I'd rather not do.

I've attached the api file (too long to list here). Here's an example of code that uses it:

Code:
$ip = $_SERVER['SERVER_ADDR'];
	$root_pass = $cpp;	 // Grabbed from database, stored in plain text
	$account = $cpu;	        // Grabbed from database, stored in plain text
	$email_user = $username;
	$email_password = $rand ;
	$email_domain = $domain;
	$email_quota = 'Unlimited';	 
	$xmlapi = new xmlapi($ip);
	$xmlapi->set_port(2083);/* the ssl port for cpanel */
	$xmlapi->password_auth($account,$root_pass);
	$xmlapi->set_output('json');	 
	$xmlapi->set_debug(1);
	print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) );
	$wm = $username . "@" . $domain;
View attachment xmlapi.zip

Thank you and have a nice day!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

You can write your script so that it includes an access hash, or "key," in the HTTP header that it sends to the server when it calls the API function. However, note that this is only available to WHM users. Documentation on this is available at:

API Authentication

Thank you.
 

Loldawg

Registered
Sep 16, 2013
2
0
1
cPanel Access Level
Website Owner
Hello :)

You can write your script so that it includes an access hash, or "key," in the HTTP header that it sends to the server when it calls the API function. However, note that this is only available to WHM users. Documentation on this is available at:

API Authentication

Thank you.
Thank you!

Just a quick one, if someone is using hosting package such as godaddy or similar, I suppose they don't have WHM access? I'm trying to make this work on widest range of hostings as possible, and from what I understand, goddady hosted sites have their own type of cpanel?

Thanks again!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Just a quick one, if someone is using hosting package such as godaddy or similar, I suppose they don't have WHM access? I'm trying to make this work on widest range of hostings as possible, and from what I understand, goddady hosted sites have their own type of cpanel?
I presume hosting companies such as GoDaddy offer Web Host Manager if they have plans for resellers, virtual private servers, or dedicated servers with cPanel.

Thank you.