Viewing 1 replies (of 1 total)
  • DS

    (@deepak-selvan)

    There is no plugin but this code should help you create a new sub-domain.

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
    
    //  $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain;
    
        $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain;
    
        $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);
    
        $newDomain = "https://" . $subDomain . "." . $rootDomain . "/";
    
    //  return "Created subdomain $newDomain";
    
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Create website plugin’ is closed to new replies.