I have been using this script to create FTP accounts very successfully
// your cPanel username
$cpanel_user = 'usernam';
// your cPanel password
$cpanel_pass = 'password';
// your cPanel skin
$cpanel_skin = 'x3';
// your cPanel domain
$cpanel_host = 'domain.com';
// ftp username
$ftp_user = 'user';
// ftp password
$ftp_pass = 'ftp_password';
// ftp home directory
$ftp_home = 'home';
// ftp quota
$ftp_quota = '0';
// create the ftp account
$request = "http://{$cpanel_user}:{$cpanel_pass}@{$cpanel_host}:2082";
$request .= "/frontend/{$cpanel_skin}/ftp/doaddftp.html";
$request .= "?login={$ftp_user}";
$request .= "&password={$ftp_pass}";
$request .= "&homedir=public_html/{$ftp_user}";
//$request .= "a={$ftp_quota}";
$result = file_get_contents($request);
echo $result;
?>
But this assumes that I have the domain pointed to the hosting. I am wanting to have this script work with a domain that is not pointed to a domain yet.
Example: http://123.456.78.910~user/
Does that make sense?