使用 httr 包通过 TOR 发送请求

时间:2021-05-03 07:15:25

标签: r tor httr

我想使用 Tor 代理和 R httr 包发送 GET 请求。我在这里找到了简单的代码:https://gist.github.com/jeroen/5127c288f8914bdb20be,但是当我尝试时:

library(httr)
GET("https://httpbin.org/get", use_proxy("socks5://localhost:9050"))

我有一个错误:

Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failed to connect to localhost port 9050: Connection refused

我在发送执行请求之前打开了 Tor 浏览器。 我也试过 9001 端口。

1 个答案:

答案 0 :(得分:0)

它适用于 9150 端口

library(httr)
GET("https://httpbin.org/get", use_proxy("socks5://localhost:9150"))