httr (version 0.1.1)

content: Extract content from a request.

Description

There are currently three ways to retrieve the contents of a request: as a raw object, content, as a character vector, text_content, and as parsed into an R object where possible, parsed_content.

Usage

content(x)

text_content(x)

parsed_content(x, ...)

Arguments

...
additional parameters passed to conversion function
x
request object

Details

parsed_content currently knows about the following mime types:

See Also

Other response methods: response, stop_for_status

Examples

Run this code
r <- POST("http://httpbin.org/post", body = list(a = 1, b = 2))
content(r) # binary content
cat(text_content(r), "\n") # text content
parsed_content(r) # json converted to an R object

rlogo <- parsed_content(GET("http://cran.r-project.org/Rlogo.jpg"))
plot(0:1, 0:1, type = "n")
rasterImage(rlogo, 0, 0, 1, 1)

Run the code above in your browser using DataCamp Workspace