copy_curl
Data retrieval
Copy file from URL with curl.
Description
copy_curl
copies file from a URL with curl.
Users may optionally specify the user-agent to include in the HTTP header.
Some websites block automated retrieval programs that do not provide a user-agent. For example, the Bureau of Labor Statistics website may block programs without an email address in the user-agent, per its usage policy.
Syntax
copy_curl filename1 filename2 [, options]
filename1 may be a URL. filename2 may be a file.
Double quotes may be used to enclose the filenames, and the quotes must be used if the filename contains embedded blanks.
Options | Description |
---|---|
user_agent(string) |
User agent to provide in the HTTP header. |
replace |
May overwrite filename2. |
Examples
Download a file from the BLS website.
"https://www.bls.gov/cpi/research-series/r-cpi-u-rs-allitems.xlsx" ///
copy_curl "r-cpi-u-rs.xlsx", user_agent(username@cbpp.org)