0
기본적으로이 스크립트는 URL의 텍스트 파일을 구문 분석하고 http 응답 코드를 반환하지만이 스크립트는 작동하지 않습니다. 파일을 가져오고 구문 분석 할 수 있지만 반환 코드를 가져올 수 없습니다. 미리 감사드립니다!루비 URL 유효성 확인
require 'net/http'
#Open URL from file
File.open("sample_input_file", "r") do |infile|
while (URI = infile.gets)
end
end
#Get HTTP response code
http = Net::HTTP.new
response = http.request_head(URI)
#Print result
if
response.code != "200"
puts URI + "Error"
else
puts "Ok"
end