Hi,
How to create a script that checks if a website is down? something similar to http://downforeveryoneorjustme.com/
Hi,
How to create a script that checks if a website is down? something similar to http://downforeveryoneorjustme.com/
You can use the Net::HTTP class to send a request. Check the class methods for an error.
http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
require 'net/http'
require 'uri'
res = Net::HTTP.get_response(URI.parse('http://www.example.com/index.html'))
when Net::HTTPSuccess, Net::HTTPRedirection
# OK
else
res.error!