如何在R getURL中使用Tor socks5 [英] How to use Tor socks5 in R getURL
问题描述
我想在R中的 getURL
函数中使用Tor。Tor正在工作(在Firefox中检查), socks5
在端口9050
。但是,当我在R中进行设置时,出现以下错误
I want to use Tor in getURL
function in R. Tor is working (checked in firefox), socks5
at port 9050
. But when I set this in R, I get the following error
html <- getURL("http://www.google.com", followlocation = T, .encoding="UTF-8", .opts = list(proxy = "127.0.0.1:9050", timeout=15))
curlPerform错误(curl = curl,.opts = opts,.encoding = .encoding):
'\ \n\nTor不是HTTP代理\n\n\nT不是HTTP代理
\n\n似乎您已配置Web浏览器以使用Tor作为HTTP代理。\n这是不正确的:Tor是SOCKS代理,不是HTTP代理。\n请相应地配置客户端。
Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) : '\n\nTor is not an HTTP Proxy\n\n\n
Tor is not an HTTP Proxy
\n\nIt appears you have configured your web browser to use Tor as an HTTP proxy.\nThis is not correct: Tor is a SOCKS proxy, not an HTTP proxy.\nPlease configure your client accordingly.
我已经尝试用袜子socks5代替代理,但是没有用。
I've tried replace proxy with socks, socks5 but it didn't work.
推荐答案
有< a href = http://cran.r-project.org/web/packages/RCurl/index.html> R的卷曲绑定,之后您可以使用curl调用Tor SOCKS5代理服务器。
There are curl bindings for R, after which you can use curl to call the Tor SOCKS5 proxy server.
shell调用(您可以将其翻译为o R绑定)是:
The call from the shell (which you can translate to the R binding) is:
curl --socks5-hostname 127.0.0.1:9050 google.com
Tor也会为A记录进行DNS。
Tor will do the DNS also for A records.
这篇关于如何在R getURL中使用Tor socks5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!