[R] File Downloading Problem

Santosh Srinivas santosh.srinivas at gmail.com
Mon Nov 1 15:37:51 CET 2010


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.

-----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