The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

doadddomain.html

Discussion in 'General Discussion' started by asmithjr, Nov 7, 2003.

  1. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  2. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    16
    Did you ever find a solutions to this?
     
  3. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    16
    Re: Re: doadddomain.html

    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. neofinder

    neofinder Registered

    Joined:
    Feb 17, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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);

    ?>
     
Loading...

Share This Page