Skip to content

GET a url.


GET(url = NULL, config = list(), ..., handle = NULL)



the url of the page to retrieve


Additional configuration settings such as http authentication (authenticate()), additional headers (add_headers()), cookies (set_cookies()) etc. See config() for full details and list of helpers.


Further named parameters, such as query, path, etc, passed on to modify_url(). Unnamed parameters will be combined with config().


The handle to use with this request. If not supplied, will be retrieved and reused from the handle_pool() based on the scheme, hostname and port of the url. By default httr requests to the same scheme/host/port combo. This substantially reduces connection time, and ensures that cookies are maintained over multiple requests to the same host. See handle_pool() for more details.


A response() object.


The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.

The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client.

The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the entity be transferred, as described in The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client.

See also

Other http methods: BROWSE(), DELETE(), HEAD(), PATCH(), POST(), PUT(), VERB()


#> Response []
#>   Date: 2023-08-15 18:20
#>   Status: 200
#>   Content-Type: text/html; charset=ISO-8859-1
#>   Size: 18.3 kB
#> <!doctype html><html itemscope="" itemtype="" ...
#> var h=this||self;function l(){return void 0! 0!==w...
#> function t(a,b,c,d,k){var e="";"&ei=")&&(e="&ei="+p(d),-1...
#> document.documentElement.addEventListener("submit",function(b){var a;if...
#> </style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:...
#> var l=this||self;var m,n=null!=(m=l.mei)?m:1,p,q=null!=(p=l.sdo)?p:!0,r...
#> a.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&...
#> 0;k<g.length;k++)-1!==g[k].name.indexOf(google.xjsu)&&(h=1),-1!==g[k].n...
#> if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbq...
#> }
#> ...
if (FALSE) {
GET("", path = "search")
GET("", path = "search", query = list(q = "ham"))

# See what GET is doing with
if (FALSE) {
url <- ""
GET(url, add_headers(a = 1, b = 2))
GET(url, set_cookies(a = 1, b = 2))
GET(url, add_headers(a = 1, b = 2), set_cookies(a = 1, b = 2))
GET(url, authenticate("username", "password"))
GET(url, verbose())

# You might want to manually specify the handle so you can have multiple
# independent logins to the same website.
if (FALSE) {
google <- handle("")
GET(handle = google, path = "/")
GET(handle = google, path = "search")