0

I want this data from the site (export.benzinpreis-aktuell.de/exportdata.txt?code=e0bDB27ekW83a95) and I don“t know how to do.

With

System.open_url(export.benzinpreis-aktuell.de/exportdata.txt?code=e0bDB27ekW83a95)

I can open the page, but when i want to read the data it doesn't work.

Also I have tried this,

      require 'uri'
      require 'net/http'

  def read
    r = Net::HTTP.get_reponse( URI.parse('http://export.benzinpreis-aktuell.de/exportdata.txt?code=e0bDB27ekW83a95') ) 
   redirect :action => :index 
  end

But I get the error message

require_compiled: error: can not find net/http
App error: no such file to load -- net/http

How can I correct this problem?

George Cummins
  • 28,485
  • 8
  • 71
  • 90

2 Answers2

1

You should put net-http and uri in your build.yml file (in extensions section), because these libraries are not included/compiled by default in a rhodes build:

extensions: 
- net-http
- uri
Douglas Lise
  • 1,466
  • 1
  • 20
  • 46
0

This should do what you need:

require 'open-uri'

file = open('http://your.url.goes.here.com/page/whatever')
result = file.read
puts result
dliggat
  • 418
  • 1
  • 4
  • 7