我尝试下载一个文件,从我需要同时发送数据的服务器上获取它 . 在命令行使用curl它工作正常:
curl "https://www.ishares.com/us/product-screener-download.dl" --data "productView=ishares&portfolios=239561-239855"
不幸的是我没有得到它与R一起工作 . 我尝试使用lib.l,download.file与libcurl,curl_download和httr . (使用curl或wget的download.file不起作用,因为我在窗口机器上 . )
我尝试过但没有使用curl:
library("curl")
handle
handle_setopt(handle, customrequest = "POST")
handle_setform(handle, productView="ishares",portfolios="239561-239855")
curl_download("https://www.ishares.com/us/products/etf-product-list", "./data/ishares-us-etf.xls", handle=handle)
我尝试过什么并没有使用httr:
library(httr)
POST("https://www.ishares.com/us/products/etf-product-list", body = list(productView="ishares",portfolios="239561-239855"))