Jump to content

How to control / monitor bandwidth in PHP ?


Recommended Posts


I am planning to make a paid proxy website where users will have to pay for surfing.

It will cover following aspects..........


When user will create account, he will have to pay by PAYPAL only.

I want to provide instant activation i.e. when payment is made, it will instantly activate his account.


Every user will get specific amount of MB for surfing. Suppose Mr.X is having his limit of 500MB, then he should be able to check how much MB he is used, how much is remaining. When quota is over, his account will be deactivated.


So question is, I can manage user management, but how to make a/c activation after making payment ?


How can I manage Bandwidth quota for each user ?


Off course I am going to purchase VPS for this purpose.


Can anybody help me ? :) :)

Link to comment
Share on other sites

What sort of bandwidth do you want to control? Data usage or speed? Data usage is easy -- just call count() on the data you retrieve or inspect the HTTP headers for Content-Length: which will tell you how long the document is. Then you can just store that somewhere temporarily (in a database for example) and do some comparisons:



if($dataUsedSoFar >= $dataLimit) {
return false; // or output a message if writing procedural code?


I don't know about limiting speed however. Maybe it's a question for your ISP who can limit those sorts of things? You might be able to do it in sockets, but I've never used sockets in PHP so I don't know. Anyone?



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.