我使用下面的sas和curl代码从网上下载文件。
data _null_;
x "cd c:\sasdata";
x "curl -O http://nseindia.com/content/indices/histdata/CNX%20NIFTY21-03-2014-21-03-
2014.csv";
run;
文件下载但内容如下
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://nseindia.com/content/indices/histdata/CNX%20NIFTY21-03-2014-21-03-2014.csv" on this server.<P>
Reference #18.e5bef75.1395641322.926b13
</BODY>
</HTML>
两天前,每件事都很好,但突然发生了上面的错误。
请帮助解决问题。
答案 0 :(得分:0)
添加用户代理-A "Mozilla"
对我有用:
curl -A "Mozilla" http://nseindia.com/content/indices/histdata/CNX%20NIFTY21-03-2014-21-03-2014.csv
它返回:
"Date","Open","High","Low","Close","Shares Traded","Turnover (Rs. Cr)"
"21-Mar-2014"," 6515.20"," 6522.90"," 6485.70"," 6493.20"," 189854420"," 8841.94"