Learn R Programming

crul (version 0.4.0)

proxies: proxy options

Description

proxy options

Usage

proxy(url, user = NULL, pwd = NULL, auth = "basic")

Arguments

url

(character) URL, with scheme (http/https), domain and port (must be numeric). required.

user

(character) username, optional

pwd

(character) password, optional

auth

(character) authentication type, one of basic (default), digest, digest_ie, gssnegotiate, ntlm, or any. optional

Details

See http://proxylist.hidemyass.com/ for a list of proxies you can use

Examples

Run this code
# NOT RUN {
proxy("http://97.77.104.22:3128")
proxy("97.77.104.22:3128")
proxy("http://97.77.104.22:3128", "foo", "bar")
proxy("http://97.77.104.22:3128", "foo", "bar", auth = "digest")
proxy("http://97.77.104.22:3128", "foo", "bar", auth = "ntlm")

# with proxy (look at request/outgoing headers)
(res <- HttpClient$new(
  url = "http://www.google.com",
  proxies = proxy("http://97.77.104.22:3128")
))
res$proxies
# }
# NOT RUN {
res$get(verbose = TRUE)
# }
# NOT RUN {
# vs. without proxy (look at request/outgoing headers)
(res2 <- HttpClient$new(url = "http://www.google.com"))
res2$get(verbose = TRUE)


# Use authentication
(res <- HttpClient$new(
  url = "http://google.com",
  proxies = proxy("http://97.77.104.22:3128", user = "foo", pwd = "bar")
))

# another example
(res <- HttpClient$new(
  url = "http://ip.tyk.nu/",
  proxies = proxy("http://200.29.191.149:3128")
))
# }
# NOT RUN {
res$get()$parse("UTF-8")
# }

Run the code above in your browser using DataLab