1

我有一个创建 cpanel FTP 帐户的脚本,如下所示:

$url = "https://$user:$pass@$domain:2083/frontend/$skin/ftp/doaddftp.html?";
$url = $url . "login=$fuser&password=$fpass&homedir=$fhomedir&quota=$fquota";
$result = @file_get_contents($url);

我试图找出删除 FTP 帐户的 URL。我看到“doaddftp.html”和 GET 参数。我假设有一种类似的方法可以删除 FTP 帐户。

有人知道网址是什么吗?

4

2 回答 2

1

以下链接将对您有用

http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiFtp#Ftp::delftp

注意:删除 FTP 帐户。此功能仅在 cPanel 11.27.x 及更高版本中可用。

于 2012-04-23T09:46:00.493 回答
0

这会起作用:

$buildRequest = '/execute/Ftp/delete_ftp?user='.$username.'&destroy=0'; # To remove the home directory of the ftp acc change to 1

$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
    return "Socket error";
    exit();
}

$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders  = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";

fputs($openSocket, $buildHeaders);
while(!feof($openSocket)) {
    fgets($openSocket,128);
}
fclose($openSocket);
于 2016-07-30T11:08:50.190 回答