Help - Search - Members - Calendar
Full Version: checking bandwidth usage
Hostony Board > General Support > PHP/MySQL
dreamer
In the cpanel, it tells you how much bandwidth you have used for this month...

because of this, I am guessing there is a way to calculate it automatically with php, or there is a server variable for it or something simaler?

I would like to write a script to check the current bandwidth usage before it links someone to a big file... so if the limit is nearing then it won't link the user to the file...

Any help shedding light on the finding out bandwith usage issue would be greatley appriciated rolleyes.gif
Stanly
It is done by CPanel API. Even if you will look into it you will not be able to use your script 'cause you have not permissions to access this info.
dreamer
aw dammit mad.gif

The only way around it I can think of would be to grab the main page from the cpanel with php and then parse it to get the current badwidth usage... very long winded complicated way of doing it... it would take a logn tiem to execute each time aswell...

If I do it, I'll probably use and fopen() for user:pass@domain.com:port/frontend/x/index.html

get it to find the <td class="index1" width="120" nowrap>Bandwidth usage (current month)</td> line and then grab the next one (with the actuall number on it)... remove the <td class="index2"> and the Megabytes</td> to get the number

If I succeed, I'll post a copy of the code wink.gif

Of course it would require having the password for the cpanel in the code... not sure if I want to do that or not yet...

maybe i'm being a little too adventurous blink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here