0

Is it possible to get information on download and upload speed using standard PHP tools (ssh2_sftp)?

Dima Kuzmin
  • 161
  • 1
  • 2
  • 10

1 Answers1

1
$start = time();

$sftp->get('filename', 'local/filename'); //gets the file
$size = $sftp->size('filename'); //gives the size of the file.

$timeTakenInSeconds = time() - $start;
echo sprintf('Bytes/second: %d', $size / $timeTakenInSeconds);
Dima Kuzmin
  • 161
  • 1
  • 2
  • 10