Reputation: 79
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.
Upvotes: 2
Views: 1786
Reputation: 57650
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
Upvotes: 5
Reputation: 53830
This will be dependent on the server that you are downloading from supporting Range Requests. Read up on Range Requests, and combine this with a multi-threaded cURL, and you'll be able to have more than one download stream working at a time.
Upvotes: 2