I'm not behind it right now, but would the following work?

require 'net/http'

url = URI.parse(params[:url])
http = Net::HTTP.new(url.host, url.port)
response = http.send_request('GET', '/')
puts response.body

Thank you.


On 19 okt, 20:18, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On Oct 19, 6:59 pm, jhaagmans <jaap.haagm...@gmail.com> wrote:> Hi,
>
> > For an app I need users to put in the domain name their website is
> > hosted on. It's important that this domain works, so I'd like my app
> > to check this. I'd like to be able to process the response. If it
> > returns a 404 error or maybe even a 500 error I'd like it to have the
> > method return true, but also a message saying there's something the
> > user needs to look into at their end. If the domain is unavailable (so
> > there is no record in the zonefile) I'd like the method to return
> > false and return an error message saying the domain is invalid. Of
> > course, if it passes with a 200 message, I'd like it to return true
> > and a success message.
>
> > Is this possible and how?
>
> Well you could use the ruby name resolving classes or make an http
> request with Net::HTTP (although beware of DNS servers that lie when
> the domain doesn't exist)
>
> Fred
>
> > Thank you very much!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to