开发者

getURL in RCurl problem behind firewall R

开发者 https://www.devze.com 2023-01-25 06:58 出处:网络
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

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) : 
  Coul开发者_如何学运维d not resolve host: www.cnn.com; Host not found

Is it at all possible to work around this?

regards,

//M


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号