Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php creating a subdomain automatically in cpanel

<?php
$domainName = 'example.com';
    $subDomainName =  'demo';
     $subDomain = $subDomainName;
    $cPanelUser = 'cpanel_user_name';
    $cPanelPass = 'cpanel_pass';
    $rootDomain = $domainName;
    
    $buildRequest = "/frontend/paper_lantern/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/$domainName/$subDomain";
      
    $openSocket = fsockopen('localhost',2082);
    if(!$openSocket) {
    return "Socket error";
    exit();
    }
    
    $authString = $cPanelUser . ":" . $cPanelPass;
    $authPass = base64_encode($authString);
    $buildHeaders  = "GET " . $buildRequest ."
";
    $buildHeaders .= "HTTP/1.0
";
    $buildHeaders .= "Host:localhost
";
    $buildHeaders .= "Authorization: Basic " . $authPass . "
";
    $buildHeaders .= "
";
    
    fputs($openSocket, $buildHeaders);
    while(!feof($openSocket)) {
    fgets($openSocket,128);
    }
    fclose($openSocket);
     
    echo $newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
?>
Comment

PREVIOUS NEXT
Code Example
Php :: how check the time of operation in laravel 
Php :: WordPress Plugin Definition 
Php :: Laravel PackageManifest.php: Undefined index: name 
Php :: date and time syntax 
Php :: socket in laravel 
Php :: sha256 php cantidad caracteres 
Php :: php header content type json 
Php :: how to rename a table element in laravel 
Php :: connect php in sql server 
Php :: IP Authorization php code 
Php :: encode zlib php 
Php :: PHP OOP - Destructor 
Php :: cara membuat koneksi php 
Php :: spatie laravel pdf image 
Php :: kill php-fpm inside docker 
Php :: laravel custom validation 
Php :: change wordpress viewport 
Php :: php take out 2 level array key value 
Php :: laravel get data from model to controller 
Php :: cara install php7.3 di ubuntu 20.04 
Php :: php change get value in a link 
Php :: php user ip from post request 
Php :: bd sms gateway, laravel sms gateway, sms sending library, bd sms, sms gateway 
Php :: carbon now set timezone 
Php :: how to check page loading time in php 
Php :: php const in class 
Php :: octobercms mail 
Php :: run phpstan terminal 
Php :: laravel defalt value null 
Php :: return pdft download and back with msg in laravel 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =