I am trying to convert following small code to curl but I am not getting successful. Any help please?

Basically that code is reading file in 8kb parts.

PHP Code:
<?php
$handle 
fopen("http://www.example.com/""rb");
$contents '';
while (!
feof($handle)) {
  
$contents .= fread($handle8192);
}
fclose($handle);
?>