I have searched existing questions on this topic but I couldn't find the solution. Requesting your attention to help me solve this problem.
I am trying to create a script to get csv file from a distant source (and upload it to the DB). I am getting the following error:
Warning:fopen(http://www.nseindia.com/products/content/sec_bhavdata_full.csv): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/path/csvUploadScript.php on line 20 Error opening data file.
I have checked php.ini file: allow_url_fopen is set "On"
This is the code I have to get the file contents:
`define('CSV_PATH','http://www.nseindia.com/products/content/');
$csvfile = CSV_PATH . "sec_bhavdata_full.csv";
$file = fopen($csvfile,"r");`
The uploading part works alright when the csv file is available on the same server but it gives error when I try to upload the csv directly from the nseindia site.
What am I doing wrong?