I have VPS server and I run a php website on it. I wrote a php script using WHM API to create new a cpanel account and I need to copy some files on a new account directory. I tried to put na ew account directory inside the main cpanel account (which main website exists) but an error occured while copying files for permission issue.
I try to use this API.
$query="createacct?username=NewUser&domain=NewUser.MyDomain.com&plan=subdomain&featurelist=default&password=NewPass&ip=n&cgi=0&hasshell=0&contactemail=subdomain@MyDomain.com&reseller=0&homedir=/home/".CPANEL."/public_html/NewUser";
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$header[0] = "Authorization: WHM ".WHMUSER.":" . preg_replace("'(\r|\n)'","",WHMHASH);
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_URL, WHMSERVER.$query);
$result = curl_exec($curl);
if ($result == false){
error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
}
curl_close($curl);
print_r(json_decode($result,true));
this script work fine and the new account created successfully all and i can login using new account to cpanel and i can use ftp and all options .
but i need to copy some files to this account directory after creation complete
I have full access to WHM and SSH and VPS root and I need any API to copy files from an account to another one by script.