You will need to write your own copy function. First check the file size with an HTTP HEAD request, for example with this solution:
http://php.net/manual/en/function.filesize.php#92462
Then do this to extract the file:
$remote = fopen('remote-file', 'r'); $local = fopen('local-file', 'w'); $read_bytes = 0; while(!feof($remote)) { $buffer = fread($remote, 2048); fwrite($local, $buffer); $read_bytes += 2048;
Emil Vikström
source share