php curl 下载mp4,使用PHP CURL下载MP4文件(Downloading MP4 files with PHP CURL)

使用PHP CURL下载MP4文件(Downloading MP4 files with PHP CURL)

我正在尝试从我的一台服务器下载视频到另一台服务器。 我使用的是CURL,因为copy()没有从视频中下载音频。 但是,CURL下载了损坏的文件(?)而没有。 这就是我现在正在下载MP4文件的方式:

$source = "https://link.com/video.mp4";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $source);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSLVERSION,3);

$data = curl_exec ($ch);

$error = curl_error($ch);

curl_close ($ch);

$destination = "video/video.mp4";

$file = fopen($destination, "wb");

fwrite($file, $data);

fclose($file);

有没有什么特别的MP4文件可以正常下载?

array(26) { ["url"]=> string(60) "https://link.com/video.mp4" ["content_type"]=> NULL ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(1) ["redirect_count"]=> int(0) ["total_time"]=> float(0.135745) ["namelookup_time"]=> float(8.4E-5) ["connect_time"]=> float(0.056009) ["pretransfer_time"]=> float(0) ["size_upload"]=> float(0) ["s

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值