Created
September 14, 2010 16:08
-
-
Save danhorst/579278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/https' | |
require 'uri' | |
@links = [ | |
"http://www.library.nd.edu/index.shtml", | |
"http://library.nd.edu/index.shtml", | |
"http://library.nd.edu" | |
] | |
@links.each do |url| | |
uri = URI.parse(url) | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
request.initialize_http_header({"User-Agent" => "Ruby Link-Checking Script"}) | |
response = http.request(request) | |
puts "#{url}, #{response.code}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see here for the inspiration