Cpanel doaddpop problem

chriswatson

Registered
Dec 26, 2003
2
0
151
Hi all,

I have a PHP script which creates a pop3 mail account using the doaddpop in cpanel. Here is the code that should create the pop3 account-

<?
$host = "www.my-domain.co.uk";
$socket = fsockopen($host,2083);
$cuser = "MyUserName";
$cpassword = "MyPassword";
$authstr = "$cuser:$cpassword";
$pass = base64_encode($authstr);
$in = "GET /frontend/bluelagoon/mail/doaddpop.html?email=testuser&domain=my-domain.co.uk&password=testpass&quota=20
HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
fputs($socket,$in);
fclose( $socket );
?>

When i run the script i receive no error message, but when i check cpanel NO email account is created!!!

My host is Klooki.net
My cpanel version is 8.5.5-EDGE 57
My cpanel theme is Bluelagoon cPanel X v2.2.6

Anyone know how i can get the above code to work or what the problem may be ?

Thanks for your help

Chris.
 

chimeraonline

Member
Jul 2, 2004
6
0
151
$host,$socket error

$host = "www.my-domain.co.uk";
$socket = fsockopen($host,2083);

should be:

$host = "my-domain.co.uk";
$socket = fsockopen($host,2082);

that is the only major difference between what you have and what I have that works:

I also use:
$sAuth = base64_encode("".$cpusername.":".$cppassword."");

instead of:
$authstr = "$cuser:$cpassword";
$pass = base64_encode($authstr);

to encode the username and password for cpanel