ruby Net::HTTP.start(URL, 80) do |http|
status = if http.get('/').body =~ /#{SRCHEXP}/ then "offers" else "does not offer" end
puts "http:\/\/#{URL} #{status} #{LANGUAGE}"
end
require 'net/http'
URL = 'langref.org' ; LANGUAGE = 'ruby' ; SRCHEXP = '.*' + 'http://' + URL + '/' + LANGUAGE + '.*'
Net::HTTP.start(URL, 80) do |http|
status = if http.get('/').body =~ /#{SRCHEXP}/ then "offers" else "does not offer" end
puts "http:\/\/#{URL} #{status} #{LANGUAGE}"
end
# May also be accomplished more succinctly via:
#
# Net::HTTP.start(URL, 80) { |http| puts "http:\/\/#{URL} %s #{LANGUAGE}" % if http.get('/').body =~ /#{SRCHEXP}/ then "offers" else "does not offer" end }