防火墙后面的 RCurl 中的 getURL 问题 R
我位于医院防火墙后面,通常必须使用 setInternet2(T)
R 才能正确访问网络。然而,运行我的代码(在家里完美运行)会导致
curlPerform(curl = curl, .opts = opts, .encoding = .encoding) :
Could not resolve host: www.cnn.com; Host not found
Is it at all possible to work around this?
问候,
//M
I'm behind hospital firewalls and usually have to use setInternet2(T)
for R to access the net properly. However running my code (that works perfectly at home) results in
curlPerform(curl = curl, .opts = opts, .encoding = .encoding) :
Could not resolve host: www.cnn.com; Host not found
Is it at all possible to work around this?
regards,
//M
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 RCurl 没有使用与 R 相同的代理设置(因此设置 internet2 没有帮助),您需要使用
curlSetOpt
命令手动设置它们: - getCurlHandle()
curlSetOpt(.opts = list(proxy = '<地址>:<端口>'),curl = curl)
ans <- getURL( 'http://www.cnn.com',curl=curl)
It looks like RCurl doesn't use the same proxy settings as R (and so setting internet2 doesn't help), you need to set them manually, with the
curlSetOpt
command:curl <- getCurlHandle()
curlSetOpt(.opts = list(proxy = '<address>:<port>'), curl = curl)
ans <- getURL('http://www.cnn.com', curl = curl)