RDocumentation: GET
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    Note that this notebook was automatically generated from an RDocumentation page. It depends on the package and the example code whether this code will run without errors. You may need to edit the code to make things work.

    if(!require('httr')) {
        install.packages('httr')
        library('httr')
    }
    GET("http://google.com/")
    GET("http://google.com/", path = "search")
    GET("http://google.com/", path = "search", query = list(q = "ham"))
    
    # See what GET is doing with httpbin.org
    url <- "http://httpbin.org/get"
    GET(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.
    google <- handle("http://google.com")
    GET(handle = google, path = "/")
    GET(handle = google, path = "search")