问题
Is is possible to resume downloading a partially downloaded file with curl or similar? I mean, let's say we have this big dbdump.sql file on a http
or ftp
server which is 1 GB in size; could I somehow tell this server please send from the file from byte x to byte y?
For simplicity's sake, what I'm looking for, with this question, does not include joining the downloaded chunks; rather just downloading the chunks and saving each as a septate file.
回答1:
You can do something like:
curl_setopt ($obj, CURLOPT_HTTPHEADER, array ("Range: bytes=1024000-2048000"));
This will work for HTTP only of course.
来源:https://stackoverflow.com/questions/5460992/resumable-and-partial-download-with-php-curl-or-similar