Search code examples
phpmultipart

how to remote download a file using multi-part downloading?


i want to download a remote file on internet to my host. but i want to download it with multi-part downloading to make it download faster. just the same as download managers.


Solution

  • You have to use Range header while requesting.

    Sending Range: bytes=500-999 will download the bytes form 500 to 999;

    Note: PHP is not a multi-threaded language. So even you download by multi-part it'll be sequential. Unless you fork multiple process. Though using third-party extensions like curl you can do this through curl_multi_exec