[R] File Downloading Problem

Duncan Murdoch murdoch.duncan at gmail.com
Mon Nov 1 15:41:55 CET 2010


On 01/11/2010 10:37 AM, Santosh Srinivas wrote:
> Nope Duncan ... no changes .. the same old way without a proxy ... actually
> the download.file is being returned "403 forbidden" which is strange.
>
> These are just two lines that I am trying to run.
>
> sURL<-
> "http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha
> v.csv.zip"
> download.file(sURL,"test.zip")
>
> Put the same URL in a browser and it works fine.

It doesn't work for me, so presumably there is some kind of security 
setting at the site (a cookie?), which allows your browser, but doesn't 
allow you to use R, or me to use anything.

Duncan Murdoch

> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
> Sent: 01 November 2010 19:04
> To: Santosh Srinivas
> Cc: 'Rhelp'
> Subject: Re: [R] File Downloading Problem
>
> On 01/11/2010 9:22 AM, Santosh Srinivas wrote:
> >  Dear Group,
> >
> >  My code stopped working ... used to work till last week!
> >
> >  sURL<-
> >
> "http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha
> >  v.csv.zip"
> >
> >  >   download.file(sURL,"test.zip")
> >  trying URL
> >
> 'http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha
> >  v.csv.zip'
> >  Error in download.file(sURL, "test.zip") :
> >     cannot open URL
> >
> 'http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha
> >  v.csv.zip'
> >  In addition: Warning message:
> >  In download.file(sURL, "test.zip") :
> >     cannot open: HTTP status was '403 Forbidden'
> >
> >  I put the same URL in  a browser and it works just fine.
>
>
> Are you using a proxy?  If you've recently updated R, you may have told
> it not to use the proxy.  You can test this by running
>
> setInternet2(TRUE)
>
> (which will use a proxy if one is defined in Internet Explorer) and
> repeating the download.file() call.  You can make Internet2 the default
> by putting --internet2 on the command line when you start R.
>
> Duncan Murdoch
>



More information about the R-help mailing list