Script needed...

Hi!

I have a file which has the following entry -

which has different service names with their corresponding URLs.

I want to echo the servicenames and curl each URL and find out if the URL is accessible or not.

#!/usr/bin/env ruby 
require 'net/http'
def checkurl(url)
    url=URI.parse(url)
    response = Net::HTTP.get_response(url)
    case response
        when Net::HTTPSuccess  , Net::HTTPRedirection
           return "OK for #{url}"
    else
        return response.error!
    end
end

File.open("servicefile").each do |line|
  puts checkurl(line) if line =~ /^http/
end

Hi, what have you tried so far?