/*Host Credentials*/
$host = "Host Name";
$port = "Port Number ex. 2083";
$HostUserName = "Your cpanel username";
$HostPassword = "Your cpanel password";
/*-------------------------*/
/*Email details which you want to create*/
$email = "email name which you want to create";
$domain = "Domain name on which you want to create the email for subdomain you can write ex. subdomain.domain.com";
$password = "Password for your email"
$quota = "limit which you want to assign for this account."
/*--------------------*/
$query = 'https://'.$host.':'.$port.'/frontend/x3/mail/doaddpop.html?email='.$email.'&domain='.$domain.'&password='.$password.'"a='.$quota;
$curl = curl_init(); // Create Curl Object
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // Allow self-signed certs
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // Allow certs that do not match the hostname
curl_setopt($curl, CURLOPT_HEADER, 0); // Do not include header in output
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // Return contents of transfer on curl_exec
$header[0] ="Authorization: Basic " . base64_encode($HostUserName.":".$HostPassword) . "\n\r";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password
curl_setopt($curl, CURLOPT_URL, $query); // execute the query
$result = curl_exec($curl);
curl_close($curl);
0 comments:
Post a Comment