API Add PDNS

From Virtualizor Wiki
Jump to: navigation, search

Add DNS Server

Parameters Type Description
addpdns POST Flag to create a DNS Server.
name POST The unique name for the DNS Server
descr POST Short description for the DNS Server'
ipaddress POST IP Address of the DNS Server
sqldb POST Database Name
sqlusername POST SQL Username
sqlpassword POST SQL Password
sqlport POST SQL Port (Default: 3306)

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);
    $post = array();
    $post['addpdns'] = 1;
    $post['name'] = 'api';
    $post['descr'] = 'apidesc';
    $post['ipaddress'] = '127.0.5.5';
    $post['sqldb'] = 'apidb';
    $post['sqlpassword'] = 'passsword';
    $post['sqlport'] = '3306';
    $post['sqlusername'] = 'user';

    $output = $admin->addpdns($post);

?>

Returns:

Array
(
    [title] => Add DNS Server
    [done] =>  1
    [error] =>
    [timenow] => 1431510419
    [time_taken] => 0.141
)