Try this:

###################################################

#!/usr/bin/ruby

require 'net/http'

h = Net::HTTP.new(ARGV[0] || 'www.nonexist-ruby-lang.org', 80)
url = ARGV[1] || '/'

begin
    resp, data = h.get(url, nil) { |a| }
    puts "Valid URL"
rescue Net::ProtoRetriableError =>detail
    puts "Retriable URL"
rescue
    puts "Not a Valid URL"
end

####################################################






----- Original Message ----- 
From: "Imobach GonzáÍez Sosa" <imodev / softhome.net>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Wednesday, May 26, 2004 8:55 AM
Subject: Checking that an URL exists


Hi all,

Well, I want to make a little script that checks if the URLs in my bookmarks
are OK (in other words, if they are online yet).

I've been hanging around with URI classes and I've seen clearly a function
that performs that check.

I've tried using open-uri.rb but, if open method fails, the script fails.

Any ideas?

Thanks in advance.

-- 
EuropeSwPatentFree
(o_.'   Imobach GonzáÍez Sosa   imobachgs / softhome.net
//\c{}  imobachgs / step.es       a2419 / dis.ulpgc.es
V__)_   imodev / softhome.net     osoh en jabber.at y jabber.org
        Usuario Linux #201634
Gentoo Linux con nù¨leo 2.6.6 sobre Intel Pentium 4