require 'net/http'
require 'uri'
#Function for Reading the Webpages
def open(url)
Net::HTTP.get(URI.parse(url))
end
available_data_file=File.open('C:/Users/modi/Desktop/DataFile.txt', 'r+')
available_data_file.each do |definition|
link=definition.split(/";"/)
link.each do |address|
spyware_url=address[3]
spyware_data=open("#{spyware_url}")
puts spyware_data
end
end
我收到的错误如下::
c:/ruby/lib/ruby/1.8/net/http.rb:564:在initialize': No connection could be made because the target machine actively refused it. - connect(2) (Errno::ECONNREFUSED)
from c:/ruby/lib/ruby/1.8/net/http.rb:564:in
打开'
来自c:/ruby/lib/ruby/1.8/net/http.rb:564:在connect'
from c:/ruby/lib/ruby/1.8/timeout.rb:48:in
超时'
来自c:/ruby/lib/ruby/1.8/timeout.rb:76:in timeout'
from c:/ruby/lib/ruby/1.8/net/http.rb:564:in
connect'
来自c:/ruby/lib/ruby/1.8/net/http.rb:557:在do_start'
from c:/ruby/lib/ruby/1.8/net/http.rb:546:in
开始'
来自c:/ruby/lib/ruby/1.8/net/http.rb:379:在get_response'
from c:/ruby/lib/ruby/1.8/net/http.rb:356:in
得到'
从1983.rb:7:open'
from 1983.rb:132
from 1983.rb:130:in
每个'
从1983.rb:130
从1983.rb:128:in