[R] File Downloading Problem

Alex Gutteridge alexg at ruggedtextile.com
Mon Nov 1 18:02:02 CET 2010


On Mon, 1 Nov 2010 20:57:47 +0530, "Santosh Srinivas"
<santosh.srinivas at gmail.com> wrote:
> It's strange and the internet connection is fine because I am able to
get
> data from yahoo.
> This was working till just yesterday ... strange if the website is
creating
> issues with public access of basic data!
> 

It's checking your HTTP UserAgent header. Spoof it for access:

> options(HTTPUserAgent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6;
en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12")
> sURL =
"http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bhav.csv.zip"
> download.file(sURL,"test")
trying URL
'http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bhav.csv.zip'
Content type 'application/zip' length 43124 bytes (42 Kb)
opened URL
==================================================
downloaded 42 Kb

-- 
Alex Gutteridge



More information about the R-help mailing list