Log In
Sign Up
Why Join Hot Scripts?
Hot Scripts
All Categories
PHP
Python
Tools & Utilities
XML
Ruby on Rails
Ajax
Web Hosting
ASP
ASP.NET
C & C++
CFML
Flash
Java
JavaScript
CGI & Perl
HTML5
Forums
Blog
Scripts
Hosted Apps
Plugins
Design Templates
Forum
Blog
Advertise
Contact Us
Register
FAQ
Rules
Calendar
Search
Today's Posts
Mark Forums Read
RSS Feeds
Current location:
Hot Scripts Forums
»
Programming Languages
»
PHP
» is it possible to control the download speed
is it possible to control the download speed
LinkBack
Thread Tools
Display Modes
#
1
(
permalink
)
06-25-09, 11:46 AM
Wanasa
Newbie Coder
Join Date: Oct 2008
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
is it possible to control the download speed
Hi everyone ,
is it possible in PHP, to control the download speed to decrease the load on the server.
regards ,
Wanasa ,
Wanasa
View Public Profile
Find all posts by Wanasa
#
2
(
permalink
)
06-25-09, 11:58 AM
bizzar528
Community Liaison
Join Date: Sep 2004
Location: Pennsylvania, US
Posts: 1,550
Thanks: 2
Thanked 16 Times in 15 Posts
Yes.
You can add sleep() to an fgets() which adds a pause to the stream being sent back to the end user's browser.
For more information, check out this link...
Bandwidth/Download Limit - bytes
bizzar528
View Public Profile
Visit bizzar528's homepage!
Find all posts by bizzar528
#
3
(
permalink
)
06-25-09, 12:22 PM
Wanasa
Newbie Coder
Join Date: Oct 2008
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
thankx man
Wanasa
View Public Profile
Find all posts by Wanasa
#
4
(
permalink
)
06-25-09, 11:10 PM
End User
Level II Curmudgeon
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Try this:
<?php
$file = "somefile.zip"; // Filename
$speed = 50; // i.e. 50 kb/s download rate
if(file_exists($file) && is_file($file)) {
header("Cache-control: private");
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($file));
header("Content-Disposition: filename=$file" . "%20");
flush();
$fd = fopen($file, "r");
while(!feof($fd)) {
echo fread($fd, round($speed*1024)); // $speed kb at a time
flush();
sleep(1);
}
fclose ($fd);
}
?>
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data
|
Oracle Date & Substring Functions
|
Code Snippet Library
| [url=http://www.codmb.com/Call Of Duty[/url]
End User
View Public Profile
Find all posts by End User
Bookmarks
Digg
del.icio.us
StumbleUpon
Google
«
little help to make search from mysql db
|
Error help! Php MkDir
»
Currently Active Users Viewing This Thread: 1
(0 members and 1 guests)
Thread Tools
Show Printable Version
Email this Page
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
Off
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Forum Rules
Forum Jump
User Control Panel
Private Messages
Subscriptions
Who's Online
Search Forums
Forums Home
General Community
Announcements
Polls
The Lounge
New Members & Introductions
Script Requests
HotScripts.com Discussion
Hot Scripts Forum Questions, Suggestions and Feedback
General HotScripts Site Discussion
HotScripts Site Bug Reports
General Web Coding
HTML/XHTML/XML
HTML5
JavaScript
CSS
Flash & ActionScript
Programming Languages
PHP
Perl
ASP
ASP.NET
C/C++
Visual Basic
Windows .NET Programming
Everything Java
Other Languages
Other Discussions
Web Servers
Database
Other Topics
Web Design
API
Frameworks
AJAX
Security
Server Administration
Portable Device Programming
Cloud Computing
Ruby on Rails
CFML
Python
Tools and Utilities
Remotely Hosted
Web Hosting
Advertising Forums
General Advertisements
Job Offers & Assistance
Traffic Exchange
Website Reviews
Web Hosting Talk
DBForums.com
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Download SPEED
Matrix007
PHP
4
05-24-08
05:34 PM
A file download control script
slabuda
Script Requests
1
05-24-07
05:23 PM
Download speed estimator
bittyboy
Script Requests
3
09-18-06
07:56 AM
All times are GMT -5. The time now is
08:40 AM
.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
LinkBack
LinkBack URL
About LinkBacks
Bookmark & Share
Digg this Thread!
Add Thread to del.icio.us
Bookmark in Technorati
Share on Facebook
Share on Stumble Upon
Share on Twitter