Problem with a simple open-uri request

14 views
Skip to first unread message

Nicolò Benigni

unread,
Mar 11, 2015, 10:47:32 AM3/11/15
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Scott Ribe

unread,
Mar 11, 2015, 10:57:16 AM3/11/15
to rubyonra...@googlegroups.com, Nicolò Benigni
On Mar 11, 2015, at 8:46 AM, Nicolò Benigni <li...@ruby-forum.com> wrote:
>
> getaddrinfo: Name or service not known

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
scott...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




Nicolò Benigni

unread,
Mar 11, 2015, 11:01:48 AM3/11/15
to rubyonra...@googlegroups.com
Scott Ribe wrote in post #1169990:
> On Mar 11, 2015, at 8:46 AM, Nicolò Benigni <li...@ruby-forum.com>
> wrote:
>>
>> getaddrinfo: Name or service not known
>
> 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.

It is exactly what I was thinking..
It doensn't work with the http://www.example.org url neither, so I guess
that the problem it on the sys configuration.

Are you sure that there is nothing else that could cause the problem,
maybe rails configuration?

Nicolò Benigni

unread,
Mar 11, 2015, 11:05:21 AM3/11/15
to rubyonra...@googlegroups.com
Stupid me! It was a permission problem on the resolv.conf file! thanks
anyway!
Reply all
Reply to author
Forward
0 new messages