drazvzi741287 2019-02-05 06:35
浏览 16

服务器显示数据而不是从一个服务器下载到另一个服务器

I have a PHP with CSV downloadable script and able to download the file in the FIRST server. Now I made a redirection of this file from the FIRST server to the SECOND server and in the second server, it is showing the data instead of downloading.

Here is the full scenario.

from the FIRST server, I am accessing like this. http://first.server/download.php?type=download

from the second server, I am accessing like this. http://second.server/api/download.php?type=download.

Here is the code that I am using in download.php

$timestamp = date("j-n-Y-H-i-s");
$fileName = $timestamp . "_complete.csv";
ob_clean();
ob_start();
ob_end_flush();
ob_end_clean();
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
//header('Content-Type: text/csv');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename=' . $fileName);
$fp = fopen('php://output', 'w');

I have added a rewrite rule in the SECOND server .htaccess file.

RewriteRule ^/api/(.*)$ /apicall/callQAapi.php?request=$1 [L,QSA,NC]

Please find below screenshot of the response from server. enter image description here

Can anyone help me out on this to download the data in the SECOND server?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 Revit2020下载问题
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch