【问题标题】:how to hide original downloading link of external site using php如何使用php隐藏外部站点的原始下载链接
【发布时间】:2023-01-14 00:31:49
【问题描述】:

所以我需要你的解决方案。 我的站点 example.com/test.php 当用户单击它时,它将从外部站点 externalsite.com/file.mkv 下载文件

我只想屏蔽外部站点 url,这样当用户单击 example.com/test.php 时,它将从外部站点 url 获取文件并且永远不会显示原始站点 url。

我尝试了下面的代码但没有工作

<?php

$id = $_GET['id'];

$filename = "https://externalsite.com/20230113100300if_/https%3A%2F%2Fs38.123apps.com%2Fvconv%2Fd%2F63c12a662da0e_mkv_ymfVHPvq.mkv";

header("Content-disposition: attachment; filename=".$filename.""); 

header('Content-type: application/octet-stream');

readfile($filename); 

?>

【问题讨论】:

  • 它需要您的 PHP 脚本来下载资源并将其提供给您的客户端。你确定你在问什么吗?
  • @DiegoD 这就是它对readfile($filename) 所做的

标签: php


【解决方案1】:

Content-disposition: 标头中的名称更改为基本名称,而不是完整的 URL。

header("Content-disposition: attachment; filename=".basename($filename)); 

【讨论】:

    猜你喜欢
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多