I am trying to download a file to get it from the server, I need to send data at the same time. It works fine with curl on the command line:
curl "https://www.ishares.com/us/product-screener-download.dl" --data "productView=ishares&portfolios=239561-239855"
Unfortunately, I do not work with R. I tried with download.file, download.file with libcurl, curl_download and with httr. (download.file with curl or wget does not work since I'm on a window machine.)
What I tried and did not work with curl:
library("curl")
handle <- new_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)
What I tried and did not work with httr:
library(httr)
POST("https://www.ishares.com/us/products/etf-product-list", body = list(productView="ishares",portfolios="239561-239855"))
source
share