Create a cPanel FTP Account

This snippet will allow you to create a cPanel database using PHP.

<?php

// your cPanel username
$cpanel_user = 'root';

// your cPanel password
$cpanel_pass = 'password';

// your cPanel skin
$cpanel_skin = 'x2';

// your cPanel domain
$cpanel_host = 'yourdomain.com';

// ftp username
$ftp_user = 'ftpuser';

// ftp password
$ftp_pass = 'ftppass';

// ftp home directory
$ftp_home = 'public_html/ftpuser';

// ftp quota
$ftp_quota = '50';

// 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={$ftp_home}";
$request .= ""a={$ftp_quota}";
$result = file_get_contents($request);
echo $result;

?>

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <i> <strong> <cite> <em> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <css>, <diff>, <drupal5>, <html>, <javascript>, <php>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.