Resumable and partial download with PHP curl or similar?

空扰寡人 提交于 2019-12-23 16:21:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!