getURL in RCurl problem behind firewall R
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)
精彩评论