Site Pinger.rb

#!/usr/bin/env ruby
 
# 
#  SitePinger.rb
#  Pings a list of sites
#  
#  Created by Caius Durling <dev at caius dot name> on 2007-07-16.
#  Copyright 2007 Hentan Software.
#  Licenced under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License.
#  
#  For Mellertime
#  Note: Remember that the last thing passed in a ruby block gets returned without specifying return
# 
 
# Require some standard libraries
'net/http''uri'
 
# I'm lazy, lets add a method to the integer class to save typing later on.
# Inserts self blank lines
"#{url}	#{status}"# Anything below here is private
# Guts of the script
# Find a website with less errors, its redirected 10 times, so we just throw an error and end the 
"HTTP redirect is too deep for #{url}"# Talk to the website using Net::HTTP & get the response
"Failed	Website Doesn't Exist"# Flick through some outcomes, then catch it with a "Failed"
"Success	#{response.code}"'location'"Failed	#{response.code}"# How to use
# From another ruby script requires the next line, otherwise delete it
# require 'SitePinger'
"http://caius.name",
  "http://hentan.eu",
  "http://swedishcampground.com/",
  "http://google.com"Example 1 -- ruby snippet -- Select Code