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.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com 6 6047
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/
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.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
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 "gracefull y 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.
FLEB <so*********@mm ers.and.evil.on es.will.bow-down-to.us> wrote in message news:<1j******* *************** *********@40tud e.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.co m/calcband.php>
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
FLEB <so*********@mm ers.and.evil.on es.will.bow-down-to.us> wrote in message news:<1j******* *************** *********@40tud e.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('CalcB andwidth');
?>
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Raychev |
last post by:
Hi everybody,
I have a need for a web app that will allow a flash client to download files
at a specified speed.
I am using Flash for an application of mine which downloads JPG slides to
users' web based app.
Because I can't control how quickly a file (in this case, a JPG slide) is
|
by: Marcus |
last post by:
I have a program that I wrote that connects to a remote server and
recieves data at random intervals. I'd like to measure the bandwidth
usage of this program. What is the best way to do this? Should I write
something into the app that can do this... if so, are there any useful
libraries for this purpose? Or, should I maybe look into using a third
party application... if so, can anyone here recommend a good one?
With much respect,
Marcus
|
by: hoenes1 |
last post by:
Hi all,
I have an asp.net application from which registered users can download
files. What I want to implement is a bandwidth restriction for certain
users. What I DON'T want to do is restrict the bandwidth on the IIS
side. It really should be handled in the code. Here is a code snippet
showing how downloads are currently handled (standard implementation I
guess):
// fs: FileStream
|
by: Richard K Bethell |
last post by:
Hi,
Want to know if anyone else encounters this issue. I maintain several
asp.net websites over the Internet. Now I love xcopy deployment. It makes it
easy to do date based change management.
But I do find some files slip through, especially if you are using standard
libraries that may not have been recently compiled. And some of my staff
routinely overlook the update procedures and will not deploy files they've
changed to all copies...
|
by: Sven |
last post by:
On an IIS 6 Web Server with multiple ASP.NET Web applications (sites), how
can I accurately measure the total bandwidth used by each site? I need to
know total bandwidth for the current day, week, month, quarter, and year.
Thanks!
| |
by: Raj |
last post by:
is it possible using C# dotnet to control the bandwidth usage
means the transfer rate of download and upload?
Thanks!
|
by: brett |
last post by:
My shared hosting service provides statistics on bandwidth usage
once/mo. I need to track bytes transferred on a daily basis. Is there
something I can do in ASP.NET 2.0 for getting bandwidth info, including
non ASP.NET pages (HTML, PHP, etc)?
Thanks,
Brett
|
by: rn5a |
last post by:
In a ASP.NET application, users can upload files from their hard disk
to the server. Users can also create new files & directories directly
on the server, rename them, delete them, edit the files etc. Whenever
a user performs any such action, I did like to find out the bandwidth
used in the process.
Is it possible to find out the bandwidth usage using ASP.NET?
|
by: FrobinRobin |
last post by:
Hi,
I intend to use Ajax for a kiosk application, it's primary usage is to
retrieve live data from my DB, it's a fairly small amount of data (5
fields, of small data size and limited to 15 rows).
When I check my server logs I can see that the kiosk page has used a
fair amount of bandwidth this month, this is obviously because a
javascript timeout refreshes the data every 10 seconds. What I need to
know is how to calculate the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |