Many thanks. I will try that.
On Thu, Jul 17, 2014 at 1:29 PM, Fábio Magalhães <fmagalh...@gmail.com> wrote: > Hi Balaji, > > Sorry, I forgot to tell that I'm running R on OSX. I don't know if > there's an easier way, but since you are running on Windows you could > try to install curl(http://curl.haxx.se/) binaries and try the curl > method again. > #! Fábio > > > On Thu, Jul 17, 2014 at 5:26 AM, Raghuraman Ramachandran > <optionsra...@gmail.com> wrote: > > Hi Fabio > > > > Can you please reproduce your output? When I tried it curl are the > following > > issues I get: > > > >>download.file(" > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > ", > >> temp, method="curl") > > Error in > > download.file(" > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > ", > > : > > object 'temp' not found > > > > Then I changed the destination file and checked again: > > download.file(" > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > ", > > "c:/", method="curl") > > Warning message: > > In > > download.file(" > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > ", > > : > > download had nonzero exit status > > > > I was still unable to get that. > > > > Thx > > Balaji > > > > > > > > On Wed, Jul 16, 2014 at 5:29 PM, Fábio Magalhães <fmagalh...@gmail.com> > > wrote: > >> > >> I was able to download it specifying the method as "curl", like this: > >> > >> > > >> > download.file(" > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > ", > >> > temp, method="curl") > >> #! Fábio > >> > >> > >> On Tue, Jul 15, 2014 at 3:46 PM, Electron Musketeer > >> <muskete...@gmail.com> wrote: > >> > Many thanks Ista. I will try other routes as well. > >> > Thanks Jeff and sorry for posting without abiding by the rules. > >> > Thanks James. I would rather automate this than download manually > >> > everytime. That is my intent. > >> > > >> > Best > >> > Balaji > >> > > >> > > >> > On Tue, Jul 15, 2014 at 7:16 PM, Ista Zahn <istaz...@gmail.com> > wrote: > >> > > >> >> 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: > >> >> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' > >> >> --header='Accept-Language: en-US,en;q=0.5' --header='Connection: > >> >> keep-alive' ' > >> >> > >> >> > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > >> >> ' > >> >> -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). > >> >> > >> >> Best, > >> >> Ista > >> >> > >> >> On Tue, Jul 15, 2014 at 11:24 AM, Electron Musketeer > >> >> <muskete...@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() > >> >> > download.file(" > >> >> > > >> >> > >> >> > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > >> >> > ",temp) > >> >> > con <- unz(temp, "a1.dat") > >> >> > data <- matrix(scan(con),ncol=4,byrow=TRUE) > >> >> > unlink(temp) > >> >> > > >> >> > > >> >> > The result is: > >> >> > cannot open URL ' > >> >> > > >> >> > >> >> > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > >> >> > ' > >> >> > In addition: Warning message: > >> >> > In download.file(" > >> >> > > >> >> > >> >> > http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip > >> >> ", > >> >> > : > >> >> > 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? > >> >> > > >> >> > Thx > >> >> > Balaji > >> >> > > >> >> > [[alternative HTML version deleted]] > >> >> > > >> >> > ______________________________________________ > >> >> > R-help@r-project.org mailing list > >> >> > https://stat.ethz.ch/mailman/listinfo/r-help > >> >> > PLEASE do read the posting guide > >> >> http://www.R-project.org/posting-guide.html > >> >> > and provide commented, minimal, self-contained, reproducible code. > >> >> > >> > > >> > [[alternative HTML version deleted]] > >> > > >> > ______________________________________________ > >> > R-help@r-project.org mailing list > >> > https://stat.ethz.ch/mailman/listinfo/r-help > >> > PLEASE do read the posting guide > >> > http://www.R-project.org/posting-guide.html > >> > and provide commented, minimal, self-contained, reproducible code. > >> > >> ______________________________________________ > >> R-help@r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.