我有以下代码:
$file_name="temp.csv";
$file_url="https://www.nseindia.com/content/historical/equities/2017/AUG/cm21AUG2017bhav.csv.zip";
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".$file_name."\"");
readfile($file_url);
此下载为temp.csv
,但始终会生成此错误:
警告:readfile(https://www.nseindia.com/content/historical/equities/2017/AUG/cm21AUG2017bhav.csv.zip):无法打开流:HTTP请求失败! HTTP / 1.0 403禁止 在 C:\ xampp \ htdocs \ mysite \ Stock \ Downloadall.php 24
我哪里错了?