使用PHP curl或类似的可恢复和部分下载? [英] Resumable and partial download with PHP curl or similar?
本文介绍了使用PHP curl或类似的可恢复和部分下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以恢复下载部分下载的文件与curl或类似的?我的意思是,我们有一个大的dbdump.sql文件在 http
或 ftp
服务器是1 GB尺寸;我可以以某种方式告诉这个服务器请从字节 x 发送到字节 y ?
$ b $为了简单起见,我在寻找这个问题,不包括加入下载的块;
解决方案
您可以执行以下操作:
curl_setopt($ obj,CURLOPT_HTTPHEADER,array(Range:bytes = 1024000-2048000));
这当然只适用于HTTP。
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.
解决方案
You can do something like:
curl_setopt ($obj, CURLOPT_HTTPHEADER, array ("Range: bytes=1024000-2048000"));
This will work for HTTP only of course.
这篇关于使用PHP curl或类似的可恢复和部分下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文