buy
Bandwidth

Bandwidth data

Description

You can use the provided CURL API to to get Bandwidth Data.

Overview

To retrieve the Bandwidth Data for any month use the use the bandwidth_admin.php script.
Please note you need to replace the date in $date to desired month in YYYYMM format to get the bandwidth data ( For instance - 202504 - for April 2025, 202503 - for march 2025). 

sample code

<?php
$user = 'root';
$pass = 'PASSWORD';

$host = 'SERVERIP or HOSTNAME';
$date = '202502'; // Format YYYYMM

$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2005/index.php?api=json&act=bandwidth&show='.$date;

// Set the curl parameters 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

if(!empty($post)){
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server. 
$resp = curl_exec($ch);
// print_r($resp);

// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = json_decode($resp, true);
print_r($res);
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list