Search code examples
rubyrhomobilerhodes

Read content from website


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?


Solution

  • 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