从URL下载.mp4

时间:2019-03-21 04:58:30

标签: php html

嗨,大家好,我正在尝试从CDN下载视频,我尝试了这些,但它不起作用,只是打开了代码。还有其他办法吗?我尝试仅使用html并将链接放在ahref中,但仍然无法正常工作。谢谢

index.html

<a href="download.php" target="_blank"> Download </a>

download.php

header("Content-disposition: inline; filename=https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4%20%22,%20'r'));%20//https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4");
header("Content-type: video/mp4:"); 
readfile("https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4%20%22,%20'r'));%20//https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4");

3 个答案:

答案 0 :(得分:0)

您不需要仅html的php文件。试试这个:

<a href="https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4%20%22,%20'r'));%20//https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4" download> Download </a>

在A标签内插入“下载”以强制另存为,而不是加载页面,希望这样做会有所帮助!

答案 1 :(得分:0)

download.php文件上。

$readfile="https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4%20%22,%20'r'));%20//https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4";

$filename = basename($readfile); // Getting the base name of the file.

file_put_contents($filename,file_get_contents($readfile));

尝试过:

$video = 'https://www.w3schools.com/html/mov_bbb.mp4';

$filename = basename($video); // Getting the base name of the file.

file_put_contents($filename,file_get_contents($video));

答案 2 :(得分:0)

如果要允许用户仅通过单击超链接即可下载该电影,则可以将Foo修改为以下内容

download.php

然后制作您的超链接

<?php    

    $filepath="https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4%20%22,%20'r'));%20//https://jalpai.fruithosted.net/dl/n/5yAtd4WcqDs60kKR/fscslmftlflcqrcd/_8uz9ekpVndEEkYA6fyLk027J8VkgpkCd9ZeMTY6MC5ZU98Uy9hUa5Atp7Ou5yroih4R_1x-L417pbMLxoER0cMn4AMd1jnbsc470JsLM5L7xerZIwM5ShswARYr3SP5--P1qZnpUmYIUBcT6-lJec24HuKPlWMoS8LYERqy3GIC7vNuM7-1H-xU1sL3jq5kG_rIkyk6Iv8vCXQIusSCsk7I3iAmTuwXW9IjrBvX3Q9mAeXMHAIZ3MSvSdDzYMLlAkaPqcZEZQZSHl7ACcWdcxHhVyl87EMIw__a--j8jv3bpVih-fXYu1wc8xKt5T3D0cJjqNxawE4fkeVI_H90kpjScNkIPiJW8IwK7sDHuEM-OgD74VeLVJ0_OxE4uV6u0eEL4FhB61Gjfk2owQnksSSqEf8Y2Ax9iWDbYnPKTNl-ir3f49gguLFiYl-O6bxy/Big+Hero+6.2014.HD+1080p.mp4";
    $filename=basename( $filepath );

    function sendfile( $filename=NULL, $filepath=NULL ){
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Pragma: no-cache");
        header("Content-Type: application/octet-stream");
        header("Content-Length: ".(string)( filesize( $filepath ) ) );
        header("Content-Disposition: inline; filename={$filename}");
        header("Content-Transfer-Encoding: binary\n");

        if( $file = @fopen( $filepath, 'rb' ) ) {
            while( !@feof( $file ) and ( connection_status()==0 ) ) {
                print( fread( $file, 1024*8 ) );
                flush();
            }
            @fclose( $file );
        }
        return( ( connection_status()==0 ) and !connection_aborted() );
    }


    call_user_func( 'sendfile', $filename, $filepath );

?>

我无法从本地工作站使用给定的url进行测试,甚至无法手动下载文件-希望它会有所帮助,但我可能会误解了。