API IP Range

From Virtualizor Wiki
Jump to: navigation, search

Add IP Range

Parameters Type Description
submitip POST Flag to add IP Range
ips6 POST An array containing feilds of the IPs
ipv6_1 POST The first field of the Subnet
ipv6_2 POST The second field of the Subnet
ipv6_3. POST The third field of the Subnet
ipv6_4 POST The fourth field of the Subnet
ipv6_5 POST The fifth field of the Subnet
ipv6_6 POST The sixth field of the Subnet
ipv6_num POST Number of IPv6 Subnet
netmask POST Routing Prefix of Netmask
ippid POST Id od the IP Pool

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['submitip'] = 1;
	$post['ips6'][0][1] = '2001';
	$post['ips6'][0][2] = '2002';
	$post['ips6'][0][3] = '2003';
	$post['ips6'][0][4] = '2004';
	$post['ips6'][0][5] = '2005';
	$post['ips6'][0][6] = '9c17';
	$post['ips6'][0][7] = '0001';
	$post['ipv6_1'] = '2001';
	$post['ipv6_2'] = '2002';
	$post['ipv6_3'] = '2003';
	$post['ipv6_4'] = '2004';
	$post['ipv6_5'] = '2005';
	$post['ipv6_6'] = '9c17';
	$post['ipv6_num'] = 5;
	$post['netmask'] = 112;
	$post['ippid'] = 6;
	
	$output = $admin->addiprange($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Add IPv6 Subnet
    [done] => Array
        (
            [range] => Array
                (
                    [1888] => 2001:2002:2003:2004:2005:9c17:2a77:0001
                    [1889] => 2001:2002:2003:2004:2005:9c17:4902:0001
                    [1890] => 2001:2002:2003:2004:2005:9c17:18d4:0001
                    [1891] => 2001:2002:2003:2004:2005:9c17:ca9a:0001
                    [1892] => 2001:2002:2003:2004:2005:9c17:17d8:0001
                    [1893] => 2001:2002:2003:2004:2005:9c17:0001:0001
                )

            [done] => 1
        )

    [error] => 
    [timenow] => 1430897255
    [time_taken] => 0.059
)