Created
June 13, 2017 14:58
-
-
Save ammarfaizi2/3a27644d81810e95da1be46f9d28f3ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
// subdomain name | |
$subdomain = 'mysubdomain'; | |
// directory - defaults to public_html/subdomain_name | |
$dir = 'public_html/mysubdomain'; | |
// create the subdomain | |
$sock = fsockopen($cpanel_host,2082); | |
if(!$sock) { | |
print('Socket error'); | |
exit(); | |
} | |
$pass = base64_encode("$cpanel_user:$cpanel_pass"); | |
$in = "GET /frontend/$cpanel_skin/subdomain/doadddomain.html?rootdomain=$cpanel_host&domain=$subdomain&dir=$dir\r\n"; | |
$in .= "HTTP/1.0\r\n"; | |
$in .= "Host:$cpanel_host\r\n"; | |
$in .= "Authorization: Basic $pass\r\n"; | |
$in .= "\r\n"; | |
fputs($sock, $in); | |
while (!feof($sock)) { | |
$result .= fgets ($sock,128); | |
} | |
fclose($sock); | |
echo $result; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment