答案 0 :(得分:0)
您可以先使用curl
下载服务器链接,然后从服务器下载。
代码从服务器链接下载文件
curl_setopt($ch, CURLOPT_SSLVERSION,3);
$source = "https://r3---sn-h557snlz.googlevideo.com/videoplayback?id=o-ALLyHMODFlHOKLmejy__bT3j3IkmFCfFfXrFA2tfi3Eu&ei=RyXFWeKkKI_cogOH0LGgAg&ip=27.34.20.130&pl=21&ratebypass=yes&itag=43&expire=1506113959&signature=6AB44626DF3DC5CC517D1B0C7DC1ACF27CC7B6A7.2BC18ED29E93C2B8150031A26E88992AB0EBDA1E&key=cms1&gir=yes&dur=0.000&source=youtube&lmt=1490104605623196&requiressl=yes&ipbits=0&sparams=clen,dur,ei,expire,gir,id,initcwndbps,ip,ipbits,ipbypass,itag,lmt,mime,mip,mm,mn,ms,mv,pcm2cms,pl,ratebypass,requiressl,source&clen=8147748&mime=video%2Fwebm&req_id=7d993d5e8d1aa3ee&redirect_counter=2&fexp=23702512&cms_redirect=yes&ipbypass=yes&mip=171.76.76.26&mm=30&mn=sn-h557snlz&ms=nxu&mt=1506094130&mv=m";
$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 = "/path/to/public/file.webm";
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
你的html可以包含如下
<a href="/file.webm" download>
Download video
</a>
答案 1 :(得分:0)
我会通过php管道文件:
$filename= 'somefile.gif';
$url = 'https://somesite.tld'.$filename;
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"$filename\"");
echo readfile($url);
使用您自己的网址和文件名尝试此操作。在浏览器中导航到这个php脚本,您的文件将被下载。