Get Virtualizor

Test Connection

After adding or updating the PowerDNS server on the Virtualizor panel, you should test the connection to ensure that the node is able to communicate with PowerDNS server. The Test Connection API allows you to test the connection to the PowerDNS server database. The API response will contain "done_test" as "1" after the connection is successfully established with the database.

HTTP Request

https://hostname:4085/index.php?act=pdns&test=PDNSID

Parameters

NameMethodValueDescriptionRequired
actGETpdnsThe action will return done_test as 1 for success and 0 for failureYes
testGETIntThe PDNS server IDYes
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $page = 1;
    $reslen = 20;
    $post['test'] = 1;

    $output = $admin->pdns($page, $reslen, $post);

    print_r(json_encode($output));  

?>

Output

{
    "title": "Power DNS",
    "done_test": "1",
    "pdns": {
        "id": "1",
        "name": "PDNS",
        "description": "",
        "sql_ipaddress": "107.189.35.163",
        "sql_port": "3306",
        "sql_username": "root",
        "sql_password": "virt@pdns@mysql@123",
        "sql_database": "powerdns",
        "use_ssl": "0",
        "encrypt_sql_pass": "0",
        "salt": ""
    },
    "timenow": "1480657029",
    "time_taken": "0.129"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list