使用 httr 包通过 TOR 发送请求

问题描述

我想使用 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 端口。

解决方法

它适用于 9150 端口

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