I want to download "Bhavcopy.cvs" file form "bseindia.com" on everyday at 5 pm. automatically.
So, I want php code that automatic download this file from "nse" website...
Please help.. The URL goes as follows
I want to build an automated function to automatically upload reports from a URL at end of the day if found on that URL. My question is the URL keeps changing daily with a date.
I want to download this in csv and save it to my server automatically..A quick help will be really appreciated. Thanks in advance

1 Year
Discussion Span
Last Post by hericles

I assume the last part of the URL, the file name, is just the date with 'EQ' in front?
If not, especially if there is no logic to file name, you'll have trouble.

Otherwise you can get the file now with:
$file = "EQ" . Date('dmy') . "_CSV.zip";
$url = "http://www.bseindia.com/download/BhavCopy/Equity/$file";

To save the file:
file_put_contents($file, fopen($url, 'r'));

Or you can use fopen to open the file and write it to folder using fwrite.

The file on the server has to exist of course and, depending on the size, you have memory issues and need to look at

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.