I am trying to create email accounts in the bluehost cpanel using php script. I tried XML API for this but it gives "Access denied" error.
Now I am trying to do the same using following code, but no success. I am able to login to CPanel but unable to crate email account.
$login = "https://my.bluehost.com/cgi/account/cpanel";
$time=time();
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $login);
curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, "ldomain=$username&lpass=$password&l_redirect=/cgi-bin/cplogin&l_server_time=$time&l_expires_min=0");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
$login_done1 = curl_exec($c);
print_r($login_done1);
$email= "https://$cpanel:2083/frontend/bluehost/mail/doaddpop.html";
curl_setopt($c, CURLOPT_URL, $email);s
curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, "email=ddddd&domain=test.org&password=test@1617&password2=test@1617"a=250&new_email_submit=Create");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
$login_done2 = curl_exec($c);
print_r($login_done2);
Any help appreciated!!