防火墙R后面的RCurl问题中的getURL

时间:2010-11-15 08:49:36

标签: r curl geturl rcurl

我落后于医院防火墙,通常必须使用setInternet2(T)让R正确访问网络。然而,运行我的代码(在家里完美运行)会导致

curlPerform(curl = curl, .opts = opts, .encoding = .encoding) : 
  Could not resolve host: www.cnn.com; Host not found

是否可以解决这个问题?

的问候,

//中号

1 个答案:

答案 0 :(得分:2)

看起来RCurl不使用与R相同的代理设置(因此设置internet2无效),您需要使用curlSetOpt命令手动设置它们:

curl <- getCurlHandle()

curlSetOpt(.opts = list(proxy = '<address>:<port>'), curl = curl)

ans <- getURL('http://www.cnn.com', curl = curl)