简体   繁体   English

直接从网站 member.bseindia.com 下载文件

[英]Download files directly from the website member.bseindia.com

I am trying to download from this link member.bseindia from the folder我正在尝试从文件夹中从此链接member.bseindia下载

CURRENCY > COMMON > DEC-2018 > 21-12-2018货币 > 普通 > 2018 年 12 月 > 21-12-2018

these files:这些文件:

BFX_CO211218.csv BFX_CO211218.csv
BFX_DP211218 BFX_DP211218
BFX_SPD_CO211218.csv BFX_SPD_CO211218.csv
BFX_SPD_CO211218.csv BFX_SPD_CO211218.csv

This is a grid and I am not able to inject code into PHP script to download them directly.这是一个网格,我无法将代码注入 PHP 脚本以直接下载它们。

I have tried using javascript auto-click but again I was stuck.我曾尝试使用 javascript 自动点击,但我又被卡住了。 I have even tried python mouse events, but they did not work.我什至尝试过 python 鼠标事件,但它们不起作用。

This is sample code of file which I can download directly using the following PHP code:这是我可以使用以下 PHP 代码直接下载的文件示例代码:

<?php
$exists = remoteFileExists('https://www.bseindia.com/download/BhavCopy/Equity/EQ'.
    $date.$month2.$year2.'_CSV.ZIP'); 

$url='https://www.bseindia.com/download/BhavCopy/Equity/EQ'.
    $date.$month2.$year2.'_CSV.ZIP';
if ($exists) {
    echo 'EQ'.$date.$month2.$year2.'_CSV.ZIP Downloaded'. "<br/>";
    $filename='EQ'.$date.$month2.$year2.'_CSV.ZIP';
    download($url,$filename);
} else {
    echo 'EQ'.$date.$month2.$year2.'_CSV.ZIP does not exists'. "<br/>";   
}

You may be able to force it with the header, Not sure if this would work but it can give you ideas.您可以使用标题强制它,不确定这是否可行,但它可以为您提供想法。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM