Problem with a simple open-uri request

I need to call third party API in my rails app. I decide to use open-uri (but also tried the NET::HTTP.get and gives me the same error), and to this:

open("http://www.example.org") do |f|         puts f.base_uri #=> http://www.example.org         puts f.status #=> ["200", "OK"] end

But it gives me:

getaddrinfo: Name or service not known

I can't come up with a solution

So it's unable to resolve the host name. Either you've got the name wrong, or there's something in your OS config preventing it from being resolved correctly.

Scott Ribe wrote in post #1169990:

Stupid me! It was a permission problem on the resolv.conf file! thanks anyway!