- Messages
- 19,181
- Reaction score
- 28
- Points
- 48
Have you ever wanted to show how much bandwidth you have used?
Well do I have a solution for you...the Brandon's cPanel Bandwidth Checker!!
Edit the user name, password, domain, and theme...don't edit the do not edit unless you know what edits to edit!!!
You can remove "echo $bandwidth;" if you like, and include this in any script and add $bandwidth to the script were you want.
This was coded for an upcoming signature I am making, but I decided to release it.
If you find a bug, or me, I will fix it and release a new update:biggrin:
Also if you use it, i would appreciate a reply on how it works for you, maybe some rep, or just a thanks.
Well do I have a solution for you...the Brandon's cPanel Bandwidth Checker!!
PHP:
<?php
/*############################
Bandwidth From cPanel
Brandon's cPanel Bandwidth Checker!!!
Brandon, for x10 <brandon@x10hosting.com>
Support Info: http://www.blnetworks.net/showthread.php?p=197#post197
############################*/
// EDIT BELOW
$username = "username"; // cPanel Username
$password = "password"; // cPanel Password
$domain = "domain"; // cPanel Domain
$theme = "x"; // cPanel Theme
// DO NOT EDIT THIS CODE
ini_set("display_errors", "0");
$file = file_get_contents("http://$username:$password@$domain:2082/frontend/$theme/index.html") or die("<b>Critical Error, Please check your configuration</b>");
$string1 = strpos($file, "Bandwidth (this month)");
$file = substr($file,$string1);
$string2 = strpos($file, "Megabytes");
$length = strlen($file);
$take = $length - $string2;
$finally = substr($file,0,-$take);
$number = explode("<td class=\"index2\">", $finally);
$number = explode(" ",$number[1]);
$bandwidth = $number[0];
// START EDITING
/*
$bandwith is now the amount of bandwith you have used!
We are echoing it, but you can do whatever with it*/
echo $bandwidth;
?>
Edit the user name, password, domain, and theme...don't edit the do not edit unless you know what edits to edit!!!
You can remove "echo $bandwidth;" if you like, and include this in any script and add $bandwidth to the script were you want.
This was coded for an upcoming signature I am making, but I decided to release it.
If you find a bug, or me, I will fix it and release a new update:biggrin:
Also if you use it, i would appreciate a reply on how it works for you, maybe some rep, or just a thanks.
Last edited: