3

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

Joris Meys
  • 106,551
  • 31
  • 221
  • 263
Misha
  • 3,114
  • 8
  • 39
  • 60
  • 1
    We need more info. What code produces this message? Does anything work over the internet from work? Does x=getURL("h ttp://www.cnn.com/") give the same error message? Is that what you are doing? Looks like an issue with DNS lookups. (not sure how to do URLs in this edit box so remove space from http above) – Spacedman Nov 15 '10 at 11:45
  • x=getURL("www.cnn.com") produces the response above. Internet works fine when I use setInternet2(T)-ie I can use install.packages etc... – Misha Nov 15 '10 at 14:22

1 Answers1

2

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)

Jean-Robert
  • 840
  • 6
  • 10
  • Looks promising if I only could figure out how to access the proxy settings in R. Is there a function that would retrieve these settings that subsequently could be fed to curlSetOpt?? – Misha Dec 14 '10 at 19:44