使用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