API Get VPS Bandwidth

From Virtualizor Wiki
Jump to: navigation, search

Get VPS Bandwidth

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

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

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

    $output = $admin->vsbandwidth();
    print_r($output);
?>

Returns:

Array
(
    [title] => VPS Bandwidth Utilization
    [vpsusage] => Array
        (
            [997] => Array
                (
                    [limit] => 0
                    [used] => 0
                    [usage] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [in] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [out] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [free] => 0
                    [limit_gb] => 0
                    [used_gb] => 0
                    [free_gb] => 0
                    [percent] => 0
                    [percent_free] => 100
                )

            [998] => Array
                (
                    [limit] => 0
                    [used] => 0
                    [usage] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [in] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [out] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                            [5] => 0
                            [6] => 0
                            [7] => 0
                            [8] => 0
                            [9] => 0
                            [10] => 0
                            [11] => 0
                            [12] => 0
                            [13] => 0
                            [14] => 0
                            [15] => 0
                            [16] => 0
                            [17] => 0
                            [18] => 0
                            [19] => 0
                            [20] => 0
                            [21] => 0
                            [22] => 0
                            [23] => 0
                            [24] => 0
                            [25] => 0
                            [26] => 0
                            [27] => 0
                            [28] => 0
                            [29] => 0
                            [30] => 0
                        )

                    [free] => 0
                    [limit_gb] => 0
                    [used_gb] => 0
                    [free_gb] => 0
                    [percent] => 0
                    [percent_free] => 100
                )
		.
		.
		.
		.
    [timenow] => 1402915286
    [time_taken] => 0.018
)