By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,829 Members | 2,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,829 IT Pros & Developers. It's quick & easy.

Check my bandwidth usage?

P: n/a
Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.

Thanks.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
FLEB wrote:
Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.


Do you have access to the raw site logs for your site only that's in an area
accessible by your PHP script? If so you can parse that for the outbound
data sent for each request.

If they're limiting the amount of bandwidth you're allowed in a month then
don't they have some sort of traffic meter you can check this yourself?

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2

P: n/a
Regarding this well-known quote, often attributed to Chris Hope's famous
"Wed, 16 Jun 2004 14:53:02 +1200" speech:
FLEB wrote:
Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.


Do you have access to the raw site logs for your site only that's in an area
accessible by your PHP script? If so you can parse that for the outbound
data sent for each request.

If they're limiting the amount of bandwidth you're allowed in a month then
don't they have some sort of traffic meter you can check this yourself?


They monitor my traffic, and I can look up the number through CPanel. I
just don't know where to get to that number in an automated manner, so the
site on its own can, for instance, degrade images or reroute if my
bandwidth is almost gone.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #3

P: n/a
FLEB wrote:
Regarding this well-known quote, often attributed to Chris Hope's famous
"Wed, 16 Jun 2004 14:53:02 +1200" speech:

FLEB wrote:

Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.


Do you have access to the raw site logs for your site only that's in an area
accessible by your PHP script? If so you can parse that for the outbound
data sent for each request.

If they're limiting the amount of bandwidth you're allowed in a month then
don't they have some sort of traffic meter you can check this yourself?

They monitor my traffic, and I can look up the number through CPanel. I
just don't know where to get to that number in an automated manner, so the
site on its own can, for instance, degrade images or reroute if my
bandwidth is almost gone.


is cpanel a webpage? What is your OS?

Michael.
Jul 17 '05 #4

P: n/a
Michael Austin wrote:
is cpanel a webpage?**What*is*your*OS?


Google is your friend: http://www.google.com/search?q=cpanel

First link on the results page.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #5

P: n/a
FLEB <so*********@mmers.and.evil.ones.will.bow-down-to.us> wrote in message news:<1j*******************************@40tude.net >...
Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.


I was also searching for similar stuff and found here
<http://www.xpenguin.com/calcband.php>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6

P: n/a
FLEB <so*********@mmers.and.evil.ones.will.bow-down-to.us> wrote in message news:<1j*******************************@40tude.net >...
Is there a way to check my site's bandwidth usage via PHP? I'd like to
"gracefully bail" if I start to get near my host's limit. Its running on a
shared Linux box, on Apache 1.3.31 and PHP v4.3.3 as a module.

Just another thought, if all the files are in PHP, output buffering _may_ help.

<?php
function CalcBandwidth($buffer)
{
$file_size = strlen($buffer);
//store the file size in DB or file
return ($buffer);
}
ob_start('CalcBandwidth');
?>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.