473,659 Members | 3,117 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bandwidth/Download Limit

Hello,

I'd like to make some download speed limitation on some of my files
using PHP. I know that an Apache module can do that, but i cannot access
my ISP Apache configuration.

My idea was to put the file into a .htaccess protected diretory and to
build a "proxy" with PHP.

I can also put a download limit (after n download per day the script
deny download). Any idea or known script doing that?

Thank you in advance,

Nicolas

Jul 17 '05 #1
1 9528
Nicolas C. <cuicui.NO-SPAM.@noos.fr> wrote:
I'd like to make some download speed limitation on some of my files
using PHP. I know that an Apache module can do that, but i cannot access
my ISP Apache configuration.

My idea was to put the file into a .htaccess protected diretory and to
build a "proxy" with PHP.


Perfectly possible. Keep the files in a protected area, create an array
with locations and call a php script with an array index to get the
file. Read the file in a buffer (eg 4k) and sleep 1 sec, my simple logic
says that the browser will get a max transfer of 4kb/s in this example:

$fp=fopen($file ,'r')
while(!feof($fp ))
{
echo fgets($fp,4096) ;
sleep(1);
}
fclose($fp);

BTW don't forget to set an appropriate mimetype, and do extensive
errorcatching.

--

Daniel Tryba

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1826
by: Samir | last post by:
Hello, I have a website that is hosted by another company. Is there some kind of php script to limit downloading to a certain amount size? And is there kind thing I can do to the .htaccess file to limit this as well??? For example I have a little media file say about 3MB or something. Once someone visits the site and wants to download this file (ie. http://www.domain.com/dir/file.wmv), I would like something check
0
2236
by: blizzard | last post by:
Hi, Sorry if this question has already been posted: How can I limit the bandwidth incoming from or outgoing to a socket to a specific byterate? I mean exactly like the WinMX options "limit in/out bandwidth".
0
1387
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
2
1598
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
9
5944
by: Chibi | last post by:
I'm writing an application that's bandwidth intense. My available bandwidth is 1.5Mbps (cable modem) and I know I can reach around 1.4Mbps, if not more. The application I am writing right now simply connects to a newsgroup and downloads the headers. It doesn't do any more specific programmming after that. However, the app will use, at most, 100kbps bandwidth. I'm hoping that it can run much faster than that and reach somewhere close...
0
5075
by: z.c | last post by:
Hi Guys, i'am on a Mission but i'am stuck, usually you can help me out. I'am trying to write a C# Application that can Limit the Network Bandwidth (In- and Out-going) per Process just like NetLimiter. But I have many Problems at the moment my biggest Problem is how to Limit the Bandwidth. With IpHlpApi.dll I can get all Processes with open Connection and the Ports they are using and I can Apply a Filter that Blocks a Port...
0
1527
by: Rex Winn | last post by:
Hi all I am looking for code/articles that can show me how to implement bandwidth throttling on a local machine using C/C++. The reason being is that I have users on Satellite Internet that if trying to download more than 160+ megabytes upon reaching the 160 megabyte limit before 24 hours get throttled down to a 10K connection and everything dies. They have requested I write a tool that will allow them to set a bandwidth level on their...
8
6026
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...
4
2545
by: salman | last post by:
Hello I am developing a server and I want to view and change the the clients TCP connection bandwidth. Please help me Salman Ali
0
8335
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,...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
tracyyun
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...
0
7356
agi2029
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...
0
5649
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();...
0
4175
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...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.