Net::HTTP looks like your best shot.
require ''net/http''
Net::HTTP.start(''www.something.com'') do |http|
response = http.get(''/index.html'')
p response.code
end
Check acceptable response codes here: http://www.w3.org/Protocols/
rfc2616/rfc2616-sec10.html
-John
--
John Smilanick
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
jsmilani@kitp.ucsb.edu
(805) 893-6307
On Mar 14, 2006, at 2:32 PM, Gustav wrote:
> Hey,
>
> I have users entering URLs into my app, is there anyway in which I can
> check to see if the URLs actually point to something before saving the
> user input? Maybe a kind of ''ping''-action that returns
true on
> success?
>
> (btw: does anyone of a tentative release date for Rails1.1? I''ve
been
> slobbering all over my RailsRecipes book and I can''t wait! Also,
Scott
> Raymond''s compiled a list of awesome stuff that''ll be
incorporated
> into
> the next release. . . link on LoudThinking.Com)
>
>
> Lots of Thanks,
> Gustav
> gustav@hamburgerrobot.com
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060314/ee0fc6b2/attachment.html