Hi.

I don't find the error
this script should read the SNR margin of my adsl line from router and 
write it on txt file...
like this but without window
http://img159.imageshack.us/my.php?image=yoda6.png


but there is an error in the script
Can you help me?

require 'open-uri'

log = File.new("stats.log", "a+")
data = []

while true do
  i = 0
  open(
"http://192.168.0.1/stattbl.html",:http_basic_authentication=>["username",
  "password"] ).each do |page|
    page.each do |html|
      case html
        when /<span.*>.*kbps<\/span>/
          html.each { |line|
            line.sub(/<span.*>(.*)kbps/) { data[i] = $1.strip }
          }
          i+=1
      end
    end
  end
  log.write "SNR: down(#{data[0]}) up(#{data[1]}) -- #{Time.now.to_s}\n"
  sleep 3
end
log.close


the error is

c:/ruby/lib/ruby/1.8/net/http.rb:2003:in `each_response_header': wrong
header line format (Net::HTTP
BadResponse)
        from c:/ruby/lib/ruby/1.8/net/http.rb:1977:in `read_new'
        from c:/ruby/lib/ruby/1.8/net/http.rb:1044:in `request'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:261:in `open_http'
        from c:/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:245:in `open_http'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:629:in `buffer_open'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:167:in `open_loop'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:165:in `open_loop'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:135:in `open_uri'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:531:in `open'
        from c:/ruby/lib/ruby/1.8/open-uri.rb:86:in `open'
        from reader.rb:8


thnks

-- 
Posted via http://www.ruby-forum.com/.