3

我在医院防火墙后面,通常必须使用setInternet2(T)R 才能正确访问网络。但是运行我的代码(在家里完美运行)会导致

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

有没有可能解决这个问题?

问候,

//M

4

1 回答 1

2

看起来 RCurl 没有使用与 R 相同的代理设置(因此设置 internet2 没有帮助),您需要使用以下curlSetOpt命令手动设置它们:

curl <- getCurlHandle()

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

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

于 2010-12-13T11:57:26.960 回答