A Modern and Flexible Web Client for R

The curl() and curl_download() functions provide highly configurable drop-in replacements for base url() and download.file() with better performance, support for encryption (https, ftps), gzip compression, authentication, and other 'libcurl' goodies. The core of the package implements a framework for performing fully customized requests where data can be processed either in memory, on disk, or streaming via the callback or connection interfaces. Some knowledge of 'libcurl' is recommended; for a more-user-friendly web client see the 'httr' package which builds on this package with http specific tools and logic.


News

2.3

  • All interruptable handles now use a global pool to share connections. Fixes #79.
  • Enable interruptable interface by default, even in non-interactive mode.
  • Update libcurl on Windows to 7.51.0
  • Unit tests now try serveral httpbin mirrors in case one goes down
  • Support open(con, blocking = FALSE) and isIncomplete() for curl() connections
  • Switch curl_fetch_stream to non-blocking implementation

2.2

  • Fixed bug in multi that did not actually enable or disable multiplexing.
  • Switch unit tests to HTTP/2 server to get HTTP/2 testing coverage
  • Fix big endian build on GLIBC systems (tnx Aurelien Jarno and Andreas Tille)

2.1

  • If libcurl >= 7.47 and was built --with-nghttp2, automatically enable HTTP/2 on HTTPS connections (matches behavior of 'curl' cmd util)
  • Upgrade to libcurl 7.50.3 (--with-nghttp2) on Windows (Adds HTTP/2 support)
  • Fix a unit test that would fail on fast servers

2.0

  • New multi interface for concurrent async requests!
  • Updated vignette with simple multi examples
  • Export handle_data() to get handle state

1.2

  • Fix for getaddrinfo GNU extension on some unix platforms

1.1

  • Fix ASAN warning in curl.c (reference after free)

1.0

  • Fix for FreeBSD
  • Simplify handle refCount system
  • Better handle locking to prevent using/modifying open handles
  • Make unit tests always close connection to prevent 'unused connection' warnings
  • Add support for interruptions in curl_download()

0.9.7

  • The non-blocking download method is now only used in interactive mode
  • Use options(curl_interrupt = TRUE) to force nonblocking in non-interactive mode
  • Updated libcurl on windows to 7.47.1. This should fix IPv6 problems.
  • Update the curl_symbols table to 7.48

0.9.6

  • Use non-blocking code in curl_fetch_memory to support user interruptions.
  • Configure script no longer assumes bash so it works on OpenBSD.
  • Fix for Snow Leopard CRAN build server.
  • Added has_internet() function.

0.9.5

  • Added nslookup() as cross-platform alternative to nsl()

0.9.4

  • Move the creation of the option table to ./R/options.R
  • The curl_options() function gains an argument to filter by name
  • Properly invoke winhttp.def file in Makevars.win (required for new toolchain)

0.9.3

  • Refactor configure script to use pkg-config
  • Use the preprocessor to extract CURLOPT symbols during install
  • Don't use setInternet2() in R > 3.2.2

0.9.2

  • Optimization for windows to make realloc in curl_fetch_memory faster
  • Updated the curl_symbols table to 7.43
  • Updated the static libraries on Windows:
    • libcurl 7.43.0
    • openssl 1.0.2d
    • libssh2 1.6.0
    • libiconv 1.14-5
    • libidn 1.31-1
  • New functions for Windows: ie_proxy_info and ie_get_proxy_for_url

0.9.1

  • Convert url argument to utf8 strings in escape/unescape
  • Endian fix for BSD systems
  • Add support for setting curlopt_xxx_large options

0.9

  • Fix for very old versions of libcurl (RHEL 5)
  • Do not convert paths to UTF-8 (only URLs)
  • Improve error message for unknown options

0.8

  • Fix for curl() character reader to invert byte-order on big endian architectures.

0.7

  • Rename the C function 'fetch' to 'fetchdata' because of Solaris conflict.
  • Move warning about missing CA bundle on Windows to onAttach.

0.6

  • Validation of SSL certificates is now enabled by default if a bundle is available.
  • Major rewrite to support configurable and reusable handles
  • Added new_handle, handle_setopt, handle_setheaders, handle_setform, handle_reset, etc.
  • Added curl_fetch interfaces for httr
  • Add ie_proxy_settings to get system proxy configuration on windows

0.5

  • Check for CURLM_CALL_MULTI_PERFORM to support very old versions of libcurl

0.4

  • Fixed a memory bug that could cause R to crash
  • Add curl_escape, curl_unescape
  • Add curl_version and curl_options

0.3

  • Add curl_download function
  • More efficient use of realloc
  • Fix for older versions of libcurl (e.g. Snow Leopard)
  • Add support for user interrupts while downloading (ESC or CTRL+C)
  • Fixed bug that caused GC to corrupt connection object
  • Refactoring and cleanup

0.2

  • add support for recycling connections

0.1

  • initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("curl")

2.6 by Jeroen Ooms, 2 months ago


https://github.com/jeroen/curl#readme (devel) https://curl.haxx.se/libcurl/ (upstream)


Report a bug at https://github.com/jeroen/curl/issues


Browse source code at https://github.com/cran/curl


Authors: Jeroen Ooms [cre, aut], Hadley Wickham [ctb], RStudio [cph]


Documentation:   PDF Manual  


Task views: Web Technologies and Services


MIT + file LICENSE license


Suggests testthat, knitr, jsonlite, rmarkdown, magrittr, httpuv, webutils

System requirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).


Imported by AzureML, BatchGetSymbols, EventStudy, FedData, GSODR, GetHFData, GetTDData, MTurkR, MTurkRGUI, OAIHarvester, OpenML, RInno, RPublica, RPushbullet, V8, W3CMarkupValidator, abbyyR, addinslist, aws.ec2metadata, biomartr, brranching, captr, citr, clarifai, clinPK, crul, crunch, dataRetrieval, ecb, elastic, federalregister, finreportr, foghorn, geoknife, gitgadget, githubinstall, googleway, gpg, httr, jsonld, magick, meteoland, opencpu, osmdata, osmplotr, pafdR, pageviews, pkggraph, quantmod, radiant.data, random, rdian, rdomains, refimpact, request, rgho, rio, rosm, rpdo, rversions, sbtools, scidb, secret, stplanr, taxizedb, telegram, tesseract, textreadr, tidyquant, trelliscope, udapi, weatherData, webmockr, webutils, wikitaxa, wrswoR.benchmark.

Depended on by VarfromPDB, oec.

Suggested by commonmark, data.table, devtools, fauxpas, fingertipsR, googleCloudStorageR, installr, jsonlite, plotly, readr, remotes, rtypeform, xml2.


See at CRAN