Dear Qiannan,
Here is the answer of you question. Use following code. This is working
code. I used this in my scripts.
require 'net/http'
require 'uri'
def page_status url
url = URI.parse(url)
http = Net::HTTP.new(url.host, url.port)
http.start do
http.request_get(url.path.empty? ? "/" : url.path) do |res|
return {:name => res.class, :code => res.code}
end
end
end
status = page_status("http://www.yourURL.com")
# Printing response class and status.
puts res_class=status[:name]
puts stat=status[:code]
On Sat, May 21, 2011 at 9:25 PM, Qiannan Zhang <[email protected]> wrote:
> Hi, all
> I need help, i do not know how to get the status of http, is there anyone
> know how to do?
> thanks
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>
--
Thanks and Regards,
Amit
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]