[R] Help with Download of a comma separated file in zip format
istazahn at gmail.com
Tue Jul 15 20:16:23 CEST 2014
Not an R question, but see
https://addons.mozilla.org/en-US/firefox/addon/cliget/ for an easy way
to see what what is going on under the hood when you download using
firefox. For your example I get
wget --header='Host: www.nseindia.com' --header='User-Agent:
Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0'
--header='Accept-Language: en-US,en;q=0.5' --header='Connection:
-O 'fo09JUL2014bhav.csv.zip' -c
Now you just need to translate that to R. (Or not, sometimes its
easier to just shell out (using e.g., 'system()' ) and download with
wget or curl).
On Tue, Jul 15, 2014 at 11:24 AM, Electron Musketeer
<musketeere at gmail.com> wrote:
> Dear Experts
> I am new to this forum and to R and was trying the following to access a
> zip file from the webpages of the NSE. Here is my code.
> temp <- tempfile()
> con <- unz(temp, "a1.dat")
> data <- matrix(scan(con),ncol=4,byrow=TRUE)
> The result is:
> cannot open URL '
> In addition: Warning message:
> In download.file("
> cannot open: HTTP status was '403 Forbidden'
> I tried accessing this file directly from the website and it is letting me
> access it. My question is why is it not letting me download from R? I have
> gone through some websites to see if this has been resolved but the older
> resolutions also do not work. Can someone help please?
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help