File: /home/imensosw/www/imenso.co/index.php
<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: https://www.imensosoftware.com/');
exit;
?>
<?php
function create_subdomain1($subd,$user,$pass,$domain)
{
echo "dasd";
$cpanelusr = $user;
$cpanelpass = $pass;
$xmlapi = new xmlapi('127.0.0.1');
$xmlapi->set_port( 2083 );
$xmlapi->password_auth($cpanelusr,$cpanelpass);
$xmlapi->set_debug(1); //output actions in the error log 1 for true and 0 false
echo $result = $xmlapi->api1_query($cpanelusr, 'SubDomain', 'addsubdomain', array($subd,$domain,0,0, '/public_html/imensi.co'));
print_r($result);
}
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
$subdomainRequest = "/frontend/paper_lantern/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/imenso.co/";
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) { return "Socket error";exit();}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $subdomainRequest."\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 = "http://" . $subDomain . "." . $rootDomain . "/";
return "Created subdomain $newDomain";
}
//echo create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain);
//echo create_subdomain('tt1','imensosw','s&3^2|][0Pr[R','imenso.in');
?>