Hello Friends, In Last Post, I write approximately Create subdomain Dynamically Using PHP. Now, after you create Subdomain Dynamically from PHP code, someplace you're in want to delete that area while you deliver choice to manipulate websites beneath your user’s account. Delete Subdomain the use of PHP is as clean as Create Subdomain, in the use of PHP. Here is script to Delete Subdomain dynamically in the use of PHP Script. It will delete sub area and additionally delete subdomain listing out of your server
function delete_subdomain($sub_domain_name,$cpanel_username,$cpanel_password,$main_domain) {
$build_request = "/frontend/x3/subdomain/dodeldomain.html?domain=". $sub_domain_name . "_" . $main_domain;
$open_socket = fsockopen('localhost',2082);
if(!$open_socket) {
return "Socket Error";
exit();
}
$auth_string = $cpanel_username . ":" . $cpanel_password;
$auth_pass = base64_encode($auth_string);
$build_headers = "GET " . $build_request ."\r\n";
$build_headers .= "HTTP/1.0\r\n";
$build_headers .= "Host:localhost\r\n";
$build_headers .= "Authorization: Basic " . $auth_pass . "\r\n";
$build_headers .= "\r\n";
fputs($open_socket, $build_headers);
while(!feof($open_socket)) {
fgets($open_socket,128);
}
fclose($open_socket);
// delete subdomain directory $pass_shell = "rm -rf /home/" . $cpanel_username . "/public_html/" . $sub_domain_name; system($pass_shell); }
// delete subdomain directory $pass_shell = "rm -rf /home/" . $cpanel_username . "/public_html/" . $sub_domain_name; system($pass_shell); }
$sub_domain_name => Your Sub Domain Name Only. For e.g. mobile
$cpanel_username => Your Cpanel Username
$cpanel_password => Your Cpanel Password
$main_domain => Main Domain Name. For e.g. www.programmingfacts.com
So at the end, your subdomain http://mobile.programmingfacts.com is probably deleted and “mobile” list may delete from server.
Delete Subdomain using PHP Script, Delete Subdomain Dynamically, How to Delete Subdomain PHP Script, Delete Subdomain PHP Example, Delete Subdomain Host gator PHP Script, Delete Subdomain Hostmosntor PHP Script, Delete Subdomain BlueHost PHP Script, Delete Subdomain Dynamically PHP Script
No comments:
Post a Comment