From: Axel Etzold Date: 2008-09-11T19:02:25+09:00 Subject: Re: How to check if a webpage exists -------- Original-Nachricht -------- > Datum: Thu, 11 Sep 2008 18:55:27 +0900 > Von: Davide Benini > An: ruby-talk@ruby-lang.org > Betreff: Re: How to check if a webpage exists > Ok folks, I probably see what's wrong. > The latest example works > > begin > puts open("http://www.does.not.exist.sdadasdas.com",:proxy=>true).read > p "i'm ok" > rescue => e > p "sorry can't do" > p "error is: #{e}" > end > > I get "sorry can't do" "error is: 400 Bad Request". > > But if I do this > > begin > puts open("http://www.jhkhjhkj.com",:proxy=>true).read > p "i'm ok" > rescue => e > p "sorry can't do" > p "error is: #{e}" > end > I get > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> xmlns="http://www.w3.org/1999/xhtml">