Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jun 2003
    Posts
    396

    Default doadddomain.html

    Does anyone know how to use the doadddomain.html from the command line or in a script?

    I have
    Code:
    <?php
    
    $new = "newsub";
    $host = "www.mydomain.com";
    $domain = "mydomain.com";
    $cpaneluser = "username";
    $cpanelpass = "password";
    $cpaneltheme= "x";
    
    if(!isset($newuser)) {
    
            $socket = fsockopen($domain,2082);
            $authstr = "$cpaneluser:$cpanelpass";
            $pass = base64_encode($authstr);
            $in = "GET /frontend/x/subdomain/doadddomain.html?domain=$new&rootdomain
    =$domain\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
            fputs($socket,$in);
            fclose( $socket );
    }
    else
            print "OK"; // this means nothing
    ?>
    but it is not adding the subdomain.
    -Albert

  2. #2
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default Re: doadddomain.html

    Originally posted by asmithjr
    Does anyone know how to use the doadddomain.html from the command line or in a script?

    I have
    Code:
    <?php
    
    $new = "newsub";
    $host = "www.mydomain.com";
    $domain = "mydomain.com";
    $cpaneluser = "username";
    $cpanelpass = "password";
    $cpaneltheme= "x";
    
    if(!isset($newuser)) {
    
            $socket = fsockopen($domain,2082);
            $authstr = "$cpaneluser:$cpanelpass";
            $pass = base64_encode($authstr);
            $in = "GET /frontend/x/subdomain/doadddomain.html?domain=$new&rootdomain
    =$domain\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
            fputs($socket,$in);
            fclose( $socket );
    }
    else
            print "OK"; // this means nothing
    ?>
    but it is not adding the subdomain.
    Did you ever find a solutions to this?

  3. #3
    Member
    Join Date
    Mar 2003
    Posts
    601

    Default Re: Re: doadddomain.html

    Originally posted by noimad1
    Did you ever find a solutions to this?
    I was able to get this code to work for anyone that would like to know:


    <?
    $username = "cpanel username";
    $password = "cpanel password";
    $udomain = "yourdomain.com";
    $authstr = "$username:$password";
    $pass = base64_encode($authstr);
    $ustring = "subdomain";

    $socket2 = fsockopen("www.yourdomain.com",2082);
    if(!$socket2)
    {
    print('Socket error');
    exit();
    }

    $indom = "GET $indom = "GET /frontend/xlagoon/subdomain/doadddomain.html?domain=$ustring&rootdomain=$udomain\r\n HTTP/1.0\r\nHost:$udomain\r\nAuthorization: Basic $pass\r\n\r\n";


    fputs($socket2,$indom);
    while (!feof($socket2)) {
    fgets ($socket2,128);
    }
    fclose($socket2);

    ?>

    Of course you would want to pull your cpanel username and password from a secure location.

    Damion

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    1

    Default help

    the code had a parse error when I ran it in /public_html/temp/subdomain.php.
    I removed the " in the $indom= "GET ... line, and it ran without error. But no "Chicago" directory was created under /public_html/ I did not see this chicago directory using my ftp software. Why did it not create this chicago directory?

    <?php
    $username = "mydomain";
    $password = "mypassword";
    $udomain = "mydomain.com";
    $authstr = "$username:$password";
    $pass = base64_encode($authstr);
    $ustring = "chicago";

    $socket2 = fsockopen("www.mydomain.com",2082);
    if(!$socket2)
    {
    print('Socket error');
    exit();
    }

    $indom = "GET $indom = GET /frontend/xlagoon/subdomain/doadddomain.html?domain=$ustring&rootdomain=$udomain\r\n HTTP/1.0\r\nHost:$udomain\r\nAuthorization: Basic $pass\r\n\r\n";


    fputs($socket2,$indom);
    while (!feof($socket2)) {
    fgets ($socket2,128);
    }
    fclose($socket2);

    ?>

Similar Threads & Tags
Similar threads

  1. inserting external html files into a html file
    By ezcybersites in forum New User Questions
    Replies: 1
    Last Post: 08-27-2006, 12:33 AM
  2. x/index.html pointing to ../x/index.html -- itself !
    By admin0 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-02-2006, 05:47 PM
  3. cron sends html source not a html email
    By ctbhost in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 01-02-2005, 12:12 PM
  4. doaddpop and doadddomain via php
    By mickie2000 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 05-03-2004, 08:11 PM
  5. Choosing preference between index.html & default.html etc
    By thedjmixman in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 05-01-2004, 01:24 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube