Download a file from url
Hello Prof Brian Ripley I installed wget for windows from http://users.ugent.be/~bpuype/wget/ <http://users.ugent.be/~bpuype/wget/> and got the results very thanks veepsirtt --------------------------------------------------------------------------------------------------------------------------------------------------
library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file, method='wget', extra="-U 'Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0'")
--2012-10-16 14:44:36-- http://(x11;/ Resolving (x11;... failed: Unknown host. wget: unable to resolve host address `(x11;' --2012-10-16 14:44:36-- http://linux)/ Resolving linux)... failed: Unknown host. wget: unable to resolve host address `linux)' --2012-10-16 14:44:36-- http://gecko/ Resolving gecko... failed: Unknown host. wget: unable to resolve host address `gecko' --2012-10-16 14:44:36-- http://firefox/5.0' Resolving firefox... failed: Unknown host. wget: unable to resolve host address `firefox' --2012-10-16 14:44:37-- http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls Resolving www.nseindia.com... 124.124.252.97, 124.124.252.107 Connecting to www.nseindia.com|124.124.252.97|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 24576 (24K) [application/vnd.ms-excel] Saving to: `C:/Users/Acer/AppData/Local/Temp/Rtmpqa0fd0/file1828c40257e' 0K .......... .......... .... 100% 5.26K=4.6s 2012-10-16 14:44:44 (5.26 KB/s) - `C:/Users/Acer/AppData/Local/Temp/Rtmpqa0fd0/file1828c40257e' saved [24576/24576] FINISHED --2012-10-16 14:44:44-- Downloaded: 1 files, 24K in 4.6s (5.26 KB/s)
wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) na.omit(data)
FII.DERIVATIVES.STATISTICS.FOR.12.Oct.2012 Col1 Col2
Col3
3 INDEX FUTURES 40230.0 1142.001965025
51478.0
4 INDEX OPTIONS 525745.0 14990.371
492126.0
5 STOCK FUTURES 35248.0 1028.378075
45162.0
6 STOCK OPTIONS 105001.0 3212.669375
105553.0
Col4 Col5 Col6
3 1430.472715225 603867.0 15419.5277629
4 14070.52175 1783758.0 50627.34217375
5 1308.1875375 1041481.0 30630.1147675
6 3230.074875 80391.0 2505.014379375
----------------------------------------------------------------------------------------------------------------------------- -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646313.html Sent from the R help mailing list archive at Nabble.com.