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.

Creating an "A" record from my php script

Discussion in 'cPanel Developers' started by bigg2, Feb 13, 2013.

  1. bigg2

    bigg2 Registered

    Joined:
    Feb 13, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi

    I have got a working script to :

    Create a database
    Add permissions
    Upload user details

    PHP:
     <?php
     
    // Your cPanel username
     
    $cpanel_user 'USER';
     
    // Your cPanel password
     
    $cpanel_pass 'PASSWORD';
     
    // Your cPanel skin
     
    $cpanel_skin 'x3';
     
    // Your cPanel domain
     
    $cpanel_host 'DOMAINHOSTING';
     
    // database username
     
    $db_user 'sql';
     
    // database password
     
    $db_pass 'PASSWORD';
     
    $db_name='00034';
     
    // create the database
     
    $site "https://$cpanel_user:$cpanel_pass@$cpanel_host:2083/frontend/$cpanel_skin/sql/";
     
    $result file_get_contents("{$site}addb.html?db={$cpanel_user}_{$db_name}");
     
    $result file_get_contents("{$site}addusertodb.html?user={$cpanel_user}_{$db_user}&db={$cpanel_user}_{$db_name}&ALL=ALL");
     
    ?>
    Above is a very basic version of my code but it works very well and would like to stick to this principle.

    What I would like is somebody to have a look at the "A" record upload as I cant just get it working.

    PHP:
    <?php
    // Your cPanel username
    $cpanel_user 'USER';
    // Your cPanel password
    $cpanel_pass 'PASSWORD';
    // Your cPanel skin
    $cpanel_skin 'x3';
    // Your cPanel domain
    $cpanel_host 'DOMAINHOSTING';
    // Domain 
    $zone_domain 'WEB';
    // Your SubDomain
    $zone_name 'test';
    // Your Record
    $zone_record 'A';
    // Your Ip
    $zone_ip '179.254.0.0';
    // create the Zone
    $site "https://$cpanel_user:$cpanel_pass@$cpanel_host:2083/frontend/$cpanel_skin/zoneedit/";
    $result file_get_contents("{$site}advanced.html?db=domain={$zone_domain}&name={$zone_name}&type={$zone_record}&address={$zone_ip}");
    ?>
    Ive had a good go but there must be something I am missing.

    Very sorry im not the best at this.

    Regards
    Ben
     
  2. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page