From: Davide Benini Date: 2008-09-11T17:15:39+09:00 Subject: Re: How to check if a webpage exists Thanks for your super-fast answer :) Yet, none of this works on my system; to be double sure I copied and pasted. In a script, I get "I'm ok" even when a page does not exist; in IRB , I always get "sorry can't do" Any suggestion? Davide > compare, > >> require 'open-uri' > => false >> begin > * open "http://www.google.com", :proxy=>true >> p "i'm ok" #<-- ok codes here >> rescue >> p "sorry can't do" #<-- not ok codes here >> end > "i'm ok" > => nil > >> begin > * open "http://this.does.not.exist.com", :proxy=>true >> p "i'm ok" >> rescue => e >> p "sorry can't do" >> p "error is: #{e}" >> end > "sorry can't do" > "error is: 503 Service Unavailable" > => nil -- Posted via http://www.ruby-forum.com/.