Learn R Programming

nanonext (version 0.7.3)

transact: ncurl Transact

Description

nano cURL - a minimalist http(s) client. Transact once over the connection and stored parameters in an ncurl Session created with ncurl_session.

Usage

transact(session)

Value

Named list of 4 elements:

  • $status - integer HTTP repsonse status code (200 - OK). Use status_code for a translation of the meaning.

  • $headers - named list of response headers (if specified in the session), or NULL otherwise. If the status code is within the 300 range, i.e. a redirect, the response header 'Location' is automatically appended to return the redirect address.

  • $raw - raw vector of the received resource (use writeBin to save to a file).

  • $data - converted character string (if specified in the session), or NULL otherwise. This may be further parsed this as html, json, xml etc. if required.

Arguments

session

an 'ncurlSession' object.

Examples

Run this code
s <- tryCatch(ncurl_session("https://httpbin.org/get"), error = identity)
if (!inherits(s, "error")) transact(s)

Run the code above in your browser using DataLab