0

Using PHP, I would like to download 50mb of a 1gb movie file to check if the upload speed of server hosting the movie goes to at least 100kB/s in that exact moment.

Is that possible?

Jack B Nimble
  • 5,039
  • 4
  • 40
  • 62
Treat
  • 182
  • 1
  • 6
  • 15

1 Answers1

1

Use curl_setopt with the CURLOPT_RANGE option.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368
  • I`m not sure about how to use it for what I need. Could you share an example? – Treat Sep 30 '11 at 20:47
  • It is completely up to the server to decide whether to respect the range request, i.e., not reliable. I would suggest using fsockopen() and stream the content until n bytes were received. – John Cartwright Sep 30 '11 at 21:19
  • Use `microtime` to figure out the start and end times, subtract the end from the start to get the number of seconds, figure out how many bytes per seconds you wound up with. – ceejayoz Sep 30 '11 at 21:41
  • really no other better solutions, anyone? – Treat Sep 30 '11 at 21:51